2 * Sherlock Library -- Prime Number Tests
4 * (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
12 static int /* Sequential search */
13 __isprime(uns x) /* We know x != 2 && x != 3 */
38 return (x == 2 || x == 3);
50 nextprime(uns x) /* Returns some prime greater than X, usually the next one or the second next one */
52 x += 5 - (x % 6); /* x is 6k-1 */
67 main(int argc, char **argv)
69 uns k = atol(argv[1]);
71 printf("%d is prime\n");
73 printf("Next prime is %d\n", nextprime(k));