$maxprimes=100; $value=1; $count=0; $start=time(); print "Printing the first $maxprimes numbers that are prime... \n"; while ($count < $maxprimes) { $value++; $composite=0;#false OUTER: for ($i=2; $i < $value; $i++) { INNER: for ($j=$i; $j<$value; $j++) { if (($j*$i) == $value) { $composite=1;#true last OUTER; } } } if (! $composite) { $count++; print "$value is prime\n"; } } $time = (time() - $start); print "Took $time seconds.";