M
Matthew Moss
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 Quiz 2:
1. Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have passed from the time on this message.
2. Support Ruby Quiz 2 by submitting ideas as often as you can! (A
permanent, new website is in the works for Ruby Quiz 2. Until then,
please visit the temporary website at
<http://matthew.moss.googlepages.com/home>.
3. Enjoy!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby Talk follow the discussion. Please reply to
the original quiz message, if you can.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Quiz #161
Reverse Divisible Numbers
This week's quiz is borrowed from Jon Galloway (http://tinyurl.com/
5jvf37).
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
upper
limit of your search. If not provided, the default should be one
million.
There are two extra rules for finding these "reverse divisible"
numbers:
1. Don't count palindromes; they are obviously reverse-divisible.
2. Don't count numbers ending with zero. Reversing such numbers forces
you
to drop leading zeros on the divisor, and that's not as much fun.
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 Quiz 2:
1. Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have passed from the time on this message.
2. Support Ruby Quiz 2 by submitting ideas as often as you can! (A
permanent, new website is in the works for Ruby Quiz 2. Until then,
please visit the temporary website at
<http://matthew.moss.googlepages.com/home>.
3. Enjoy!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby Talk follow the discussion. Please reply to
the original quiz message, if you can.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Quiz #161
Reverse Divisible Numbers
This week's quiz is borrowed from Jon Galloway (http://tinyurl.com/
5jvf37).
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
upper
limit of your search. If not provided, the default should be one
million.
There are two extra rules for finding these "reverse divisible"
numbers:
1. Don't count palindromes; they are obviously reverse-divisible.
2. Don't count numbers ending with zero. Reversing such numbers forces
you
to drop leading zeros on the divisor, and that's not as much fun.