Forgot to send in my own solution: summary coming shortly.



class Integer
  def divides?(n)
    (n % self).zero?
  end

  def reverse
    self.to_s.reverse.to_i
  end
end

def count(lower, upper, incr)
  raise "Require lower <= upper" if lower > upper
  raise "Require incr > 0" unless incr > 0

  while lower <= upper do
    yield lower
    lower += incr
  end
end

limit = (ARGV[0] || 1_000_000).to_i

count(0, limit, 9) do |i|
  next if 10.divides?(i)

  ir = i.reverse
  next unless ir < i

  puts "#{i} == #{ir} * #{i / ir}" if ir.divides?(i)
end