This is a fairly simple quiz this week, as I’m in the middle of
putting together a new website to replace the existing RQ2 website,
which was supposed to be temporary. Hopefully the new one should be in
place next week.
The three rules of Ruby Q. 2:
Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have passed from the time on this message.
Support Ruby Q. 2 by submitting ideas as often as you can! (A
permanent, new website is in the works for Ruby Q. 2. Until then,
please visit the temporary website at
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby T. follow the discussion. Please reply to
the original quiz message, if you can.
Reverse Divisible Numbers
This week’s quiz is borrowed from Jon Galloway (http://tinyurl.com/
Don’t read the comments or solution there without trying this first!
Your task is to write a bit of Ruby code that will find and report all
integers that are divisible by their reverse. For example, 9801 is
divisible by 1089.
Your script should accept a single, optional argument to specify the
limit of your search. If not provided, the default should be one
There are two extra rules for finding these “reverse divisible”
- Don’t count palindromes; they are obviously reverse-divisible.
- Don’t count numbers ending with zero. Reversing such numbers forces
to drop leading zeros on the divisor, and that’s not as much fun.