[ create a new paste ] login | about

Link: http://codepad.org/8tNlkseg    [ raw code | output | fork ]

PHP, pasted on Feb 23:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

function isPrimary($num){
    if ($num % 2 == 0 || $num % 3 == 0 || $num % 5 ==0){
      return false;
    }

    return true;
}

for($i=5;$i<=100;$i++){
   if (isPrimary($i)){
       echo "$i\n";
   }
}


Output:
7
11
13
17
19
23
29
31
37
41
43
47
49
53
59
61
67
71
73
77
79
83
89
91
97


Create a new paste based on this one


Comments: