Created
October 23, 2017 11:14
-
-
Save Villach927/f183e8cbf8df716d1caafa370e43d6bf to your computer and use it in GitHub Desktop.
数学のやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$LIMIT = 10000; | |
$n = 15; | |
$z = false; | |
for($m = 1;$m < $LIMIT;++$m){ | |
for($p = 2;$p < $LIMIT;++$p){ | |
$f = false; | |
for($k = 2;$k <= sqrt($p);++$k){ | |
if($p % $k === 0) $f = true; | |
} | |
if($f === false && $p + $n === $m * $m){ | |
echo $n . " + " . $p . " = " . $m * $m . "\n"; | |
$z = true; | |
} | |
} | |
} | |
if(!$z) echo $n . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment