Skip to content

Instantly share code, notes, and snippets.

@vekexasia
Forked from anonymous/test2.php
Last active December 20, 2015 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vekexasia/6155244 to your computer and use it in GitHub Desktop.
Save vekexasia/6155244 to your computer and use it in GitHub Desktop.
<?php
$arr = array();
for($i = 4; $i <= 1000000; $i++){
if(!isPrime($i)){
array_push($arr,$i);
}
}
function isPrime($number){
if ($number % 2 == 0) {
return false;
}
for ($i=3; $i<=($number / 2); $i+=2) {
if($number % $i == 0) {
return false;
}
}
return true;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment