Skip to content

Instantly share code, notes, and snippets.

@adamgamble
Created July 13, 2012 19:02
Show Gist options
  • Save adamgamble/3106713 to your computer and use it in GitHub Desktop.
Save adamgamble/3106713 to your computer and use it in GitHub Desktop.
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