Commit | Line | Data |
---|---|---|
1 | <?php\r | |
2 | \r | |
3 | //FUNCTION IS_PRIME()\r | |
4 | \r | |
5 | function is_prime ($num) {\r | |
6 | \r | |
7 | if($num < 2) { return (0); } \r | |
8 | if ( ($num > 2) && (($num % 2) == 0) ) { return (0); }\r | |
9 | $i = 2;\r | |
10 | while ($i < $num) {\r | |
11 | if ( ($num % $i) == 0 ) { return (0); }\r | |
12 | $i++;\r | |
13 | }\r | |
14 | return (1);\r | |
15 | }\r | |
16 | \r | |
17 | //CODE\r | |
18 | \r | |
19 |