Prime number calculator
Calculate prime number until:
if ($_POST['count'] != ""){ if (is_numeric($_POST['count'])){ $time_start = microtime(1); $x = $_POST['count']; for($i=1;$i<=$x;$i++) { $f=sqrt($i); for($z=1;$z<=$f;$z++) { $y=$i%$z; if($y==0){ $l++; } if($l>=2){ break; } } if ($l<=1){ echo "$i, "; $b++; } $l=0; } $time_end = microtime(1); $time = $time_end - $time_start; echo "
[ Found prime numbers to $x in $time seconds ]
"; } else { echo "
Please enter a number!
"; } } ?>