2 * The UCW Library -- Prime numbers
4 * (c) 2008 Michal Vaner <vorner@ucw.cz>
6 * Code taken from ucw/lib.h by:
8 * (c) 1997--2008 Martin Mares <mj@ucw.cz>
9 * (c) 2005 Tomas Valla <tom@ucw.cz>
10 * (c) 2006 Robert Spalek <robert@ucw.cz>
11 * (c) 2007 Pavel Charvat <pchar@ucw.cz>
13 * This software may be freely distributed and used according to the terms
14 * of the GNU Lesser General Public License.
25 * Return a non-zero value iff @x is a prime number.
26 * The time complexity is `O(sqrt(x))`.
31 * Return some prime greater than @x. The function does not checks overflows, but it should
32 * be safe at least for @x lower than `1U << 31`.
33 * If the Cramer's conjecture is true, it should have complexity `O(sqrt(x) * log(x)^2)`.
40 * Quickly lookup a precomputed table to return a prime number greater than @x.
41 * Returns zero if there is no such prime (we guarantee the existance of at
42 * least one prime greater than `1U << 31` in the table).
44 uns next_table_prime(uns x);
47 * Quickly lookup a precomputed table to return a prime number smaller than @x.
48 * Returns zero if @x is smaller than `7`.
50 uns prev_table_prime(uns x);
52 #endif // _UCW_PRIME_H