codingtests/solutions/ProjectEuler/036/solve.php

12 lines
192 B
PHP
Raw Permalink Normal View History

2012-04-25 13:26:13 +00:00
<?php
define('MAX',1000000);
$result = 0;
for($i=1;$i<MAX;$i+=2) {
if($i == strrev($i)) {
$bin = decbin($i);
if($bin == strrev($bin)) {
$result += $i;
}
}
}
echo $result;