Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marcus Hoffmann
nettle
Commits
f7c560ee
Commit
f7c560ee
authored
Jan 03, 2008
by
Niels Möller
Browse files
*** empty log message ***
Rev: nettle/bignum-next-prime.c:1.2
parent
46e8bbc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
bignum-next-prime.c
View file @
f7c560ee
...
...
@@ -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
,
'+'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment