35 lines (27 with data), 510 Bytes
/*
A list of primes for hash tables.
next_prime(x) - returns the next prime number higher
than x.
o part of the nice descriptions project :-)
Dredd 1992 - Shattered World.
*/
array primes;
reset(arg)
{
if (!arg) {
primes = [
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
29, 31, 37, 41, 43, 47, 51, 53, 57, 61, 71,
83, 91, 101, 123, 1001
];
}
}
int next_prime(int x)
{
int i, y;
y = sizeof(primes);
for (i = 0; i < y; i++) {
if (x >= primes[i]) continue;
return primes[i];
}
}