Advertisement
xladomaz

Search prime numbers

Jul 10th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.14 KB | None | 0 0
  1. function is_prime($n){
  2.     if($n==1)
  3.         return false;
  4.     for($d=2; $d*$d<=$n; $d++){
  5.         if($n%$d==0)
  6.             return false;
  7.         }
  8.     return true;
  9.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement