Skip to content

Instantly share code, notes, and snippets.

@charlesponti
Created May 6, 2013 18:13
Show Gist options
  • Save charlesponti/5526947 to your computer and use it in GitHub Desktop.
Save charlesponti/5526947 to your computer and use it in GitHub Desktop.
Project Euler: Problem 4
def is_palindrome?(num)
num == num.to_s.reverse.to_i ? true : false
end
def palindromatic
range = *(100..999)
results = []
range.each { |i| range.each { |x| results << (i*x) if is_palindrome?(i*x) } }
p results.sort.last
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment