Skip to content

Instantly share code, notes, and snippets.

@kazua
Last active December 29, 2015 06:19
Show Gist options
  • Save kazua/7627816 to your computer and use it in GitHub Desktop.
Save kazua/7627816 to your computer and use it in GitHub Desktop.
Project Euler Problem 8(PHP)
<?php
//http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%208
//write kazua
function problem008() {
for ($a = 1; $a < 1000; $a++)
for ($b = $a + 1; $b < 1000 - $a; $b++)
if (pow($a, 2) + pow($b, 2) == pow(1000 - $a - $b, 2))
return ($a * $b * (1000 - $a - $b));
}
echo problem008();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment