Skip to content

Instantly share code, notes, and snippets.

@DarrenN
Created December 20, 2010 04:31
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 DarrenN/748016 to your computer and use it in GitHub Desktop.
Save DarrenN/748016 to your computer and use it in GitHub Desktop.
Project Euler #9 in Ruby
for n in 0..100
for m in 1..100
if (m>n)
a = 2*m*n
b = (m**2 - n**2)
c = (m**2 + n**2)
end
if (a + b + c == 1000)
puts "Triplet = #{a} + #{b} = #{c} of which the product is #{a*b*c}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment