Skip to content

Instantly share code, notes, and snippets.

@eric1234
Created October 8, 2009 05:35
Show Gist options
  • Select an option

  • Save eric1234/204781 to your computer and use it in GitHub Desktop.

Select an option

Save eric1234/204781 to your computer and use it in GitHub Desktop.
Problem 9 on Project Euler
class Numeric
def squared
self * self
end
end
(1..1000/3).each do |a|
(a+1..1002-2*a).each do |b|
c = 1000 - a - b
if a + b > c && a.squared + b.squared == c.squared
puts a * b * c
exit
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment