Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brian Smith
nettle
Commits
f7c560ee
Commit
f7c560ee
authored
17 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
*** 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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bignum-next-prime.c
+6
-2
6 additions, 2 deletions
bignum-next-prime.c
with
6 additions
and
2 deletions
bignum-next-prime.c
+
6
−
2
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
,
'+'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment