Skip to content

Instantly share code, notes, and snippets.

@StevenClontz
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenClontz/9452759 to your computer and use it in GitHub Desktop.
Save StevenClontz/9452759 to your computer and use it in GitHub Desktop.
integer powers of 2 which are palindromes
[system] ~
$ irb
irb(main):001:0> (0..10**4).each do |n|
irb(main):002:1* p = 2 ** n
irb(main):003:1> puts p if p.to_s == p.to_s.reverse
irb(main):004:1> end
1
2
4
8
=> 0..10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment