Nieuw lid |
|
Waarvoor gaat de code maar tot 200000, terwijl ik heb gezegd dat hij tot de limiet moet gaan.
Hier staat een voorbeeld: http://www.meputrecht.nl/priem.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Priemgetallen</title>
</head>
<body>
<?php
$limit=2147483647;
$to_test=2;
while(TRUE)
{
$testdiv=2;
if ($to_test > $limit)
break;
while (TRUE)
{
if ($testdiv > sqrt($to_test))
{
print "$to_test<br />\n";
break;
}
if ($to_test % $testdiv == 0)
break;
$testdiv = $testdiv + 1;
}
$to_test = $to_test + 1;
}
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Priemgetallen</title> </head> <body> <?php $limit=2147483647; $to_test=2; while(TRUE) { $testdiv=2; if ($to_test > $limit) break; while (TRUE) { if ($testdiv > sqrt($to_test)) { print "$to_test<br />\n"; break; } if ($to_test % $testdiv == 0) break; $testdiv = $testdiv + 1; } $to_test = $to_test + 1; } ?> </body> </html>
|