时间:2021-07-01 10:21:17 帮助过:2人阅读
$ss = 2;
$max = 1000;
$arr = array();
echo $max."以内的素数为:";
while ($ss < $max):
$boo = false;
foreach ($arr as $value):
if ($ss % $value == 0):
$boo = true;
break;
endif;
endforeach;
if (!$boo):
echo $ss." ";
$arr[count($arr)] = $ss;
endif;
$ss++;
endwhile;
echo "
";
?>