2 * Sherlock Library -- Prime Number Tests
4 * (c) 1997 Martin Mares <mj@ucw.cz>
9 static int /* Sequential search */
10 __isprime(uns x) /* We know x != 2 && x != 3 */
35 return (x == 2 || x == 3);
47 nextprime(uns x) /* Returns some prime greater than X, usually the next one or the second next one */
49 x += 5 - (x % 6); /* x is 6k-1 */
66 main(int argc, char **argv)
68 uns k = atol(argv[1]);
70 printf("%d is prime\n");
72 printf("Next prime is %d\n", nextprime(k));