Skip to content

Instantly share code, notes, and snippets.

@bih
Last active August 29, 2015 13:57
Show Gist options
  • Save bih/9731302 to your computer and use it in GitHub Desktop.
Save bih/9731302 to your computer and use it in GitHub Desktop.
Palindromic numbers in Ruby
class Fixnum
def is_palindromic?
self.to_s == self.to_s.reverse
end
end
100.is_palindromic? # => false
2002.is_palindromic? # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment