The assignment:
My code:The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
It just shows a white screen...PHP Code:<center>
<?PHP
function isPrime($num) {
for ($i = $num-1; $i > 1; $i--)
if ($num % $i == 0) return false;
return true;
}
$num = 600851475143;
for ($x = $num-1; $x > $num; $x--)
if (($num % $x == 0) && isPrime($x))
die(strval($x));
?>
</center>
Edit: the &# 37 is a % in my code... not sure why it's doing that




Reply With Quote