solve.php hinzugefügt
This commit is contained in:
commit
7b63512d28
26
solve.php
Normal file
26
solve.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set("display_errors", 1);
|
||||
|
||||
$number = 0;
|
||||
|
||||
while ($number < 500000) {
|
||||
$number++;
|
||||
|
||||
if (!isSquareNumber($number) or !crossSumIs43($number)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo "FOUND: $number\n";
|
||||
}
|
||||
|
||||
function isSquareNumber($number): bool
|
||||
{
|
||||
return ($sqrt = sqrt($number)) == floor($sqrt);
|
||||
}
|
||||
|
||||
function crossSumIs43($number): bool
|
||||
{
|
||||
return array_sum(str_split(strval($number))) === 43;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user