Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function canBeExpressedByAPairOfCubes($n) {
- $f = 0;
- for ($i = 1; $i < pow($n, 1 / 3); $i++)
- $a[$i] = pow($i, 3);
- foreach ($a as $b)
- foreach ($a as $c)
- if ($b + $c == $n)
- $f+=0.5;
- if ($f > 1)
- echo "$n has {$f} pairs found \n";
- }
- for ($i = 1; $i < 2000; $i++) canBeExpressedByAPairOfCubes($i);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement