Skip to content

Instantly share code, notes, and snippets.

@bencoveney
Created June 15, 2014 17:28
Show Gist options
  • Save bencoveney/30ea859001bec82209bd to your computer and use it in GitHub Desktop.
Save bencoveney/30ea859001bec82209bd to your computer and use it in GitHub Desktop.
Special Pythagorean triplet
for(var a = 1; a < 1000; a++)
{
for(var b = a; b < 1000; b++)
{
// find c
c = Math.sqrt((a*a)+(b*b));
if(a+b+c == 1000)
{
console.log(a*b*c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment