Skip to content

Instantly share code, notes, and snippets.

@joecannatti
Created December 28, 2011 02:49
Show Gist options
  • Save joecannatti/1525933 to your computer and use it in GitHub Desktop.
Save joecannatti/1525933 to your computer and use it in GitHub Desktop.
euler36
#!/usr/bin/env ruby
results = []
(1..1000000).each do |value|
if((value.to_s == value.to_s.reverse) && (value.to_s(2) == value.to_s(2).reverse))
results << value
end
end
p results.inject(&:+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment