Skip to content
Snippets Groups Projects
Commit f7c560ee authored by Niels Möller's avatar Niels Möller
Browse files

*** empty log message ***

Rev: nettle/bignum-next-prime.c:1.2
parent 46e8bbc5
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,9 @@
# define UNLIKELY(cond) cond
#endif
/* From some benchmarking using the examples nextprime(200!) and
nextprime(240!), it seems that it pays off to use a prime list up
to around 5000--10000 primes. */
static const unsigned primes[] = {
#if 0
3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
......@@ -62,7 +65,7 @@ static const unsigned primes[] = {
797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877,
881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971,
977, 983, 991, 997
#elif 0
#elif 1
3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227,
......@@ -231,6 +234,7 @@ bignum_next_prime(mpz_t p, mpz_t n, unsigned count, unsigned prime_limit,
if (progress)
progress(progress_ctx, '.');
#if 1
/* FIXME: I doubt this Fermat test saves any time. */
/* Fermat test, with respect to 2 */
mpz_set_ui(tmp, 2);
......@@ -242,7 +246,7 @@ bignum_next_prime(mpz_t p, mpz_t n, unsigned count, unsigned prime_limit,
continue;
}
#endif
if (progress)
progress(progress_ctx, '+');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment