Created
July 13, 2012 19:02
-
-
Save adamgamble/3106713 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixnum | |
def is_palindromic? | |
self.to_s.reverse.to_i == self | |
end | |
end | |
palindromic_numbers = [] | |
(100...999).each do |i| | |
(100...999).each do |g| | |
new_num = i * g | |
palindromic_numbers << new_num if new_num.is_palindromic? | |
end | |
end | |
puts palindromic_numbers.max |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment