Skip to content

Instantly share code, notes, and snippets.

@adeguntoro
Created November 13, 2019 15:27
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 adeguntoro/0f5f04437ed40a6f602d0652f6153706 to your computer and use it in GitHub Desktop.
Save adeguntoro/0f5f04437ed40a6f602d0652f6153706 to your computer and use it in GitHub Desktop.
Check all prime number
<?php
$count = 0;
$num = 2;
while ( $count < 15 ){
$div_count = 0 ;
for ( $i=1; $i<=$num; $i++){
if (($num%$i)==0) {
$div_count++;
}
}
if ($div_count < 3){
echo $num." , ";
$count = $count+1;
}
$num=$num+1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment