2 * Sherlock Library -- Prime Number Tests
4 * (c) 1997 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
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 */
69 main(int argc, char **argv)
71 uns k = atol(argv[1]);
73 printf("%d is prime\n");
75 printf("Next prime is %d\n", nextprime(k));