summaryrefslogtreecommitdiffstats
path: root/primes/primes.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2018-02-03 15:40:29 +0000
committerchristos <christos@NetBSD.org>2018-02-03 15:40:29 +0000
commite5c17e55df9ac3ba0cc4e6836b1296ca4e09c863 (patch)
tree583cfb88d5033a8358b72877f951c45d1307673f /primes/primes.c
parent18958ee2a20b22fe016fc80f46385a0c7cbe04f1 (diff)
downloadbsdgames-darwin-e5c17e55df9ac3ba0cc4e6836b1296ca4e09c863.tar.gz
bsdgames-darwin-e5c17e55df9ac3ba0cc4e6836b1296ca4e09c863.tar.zst
bsdgames-darwin-e5c17e55df9ac3ba0cc4e6836b1296ca4e09c863.zip
PR/52976: Eitan Adler: handle larger primes
Using results from J. Sorenson and J. Webster, Strong pseudoprimes to twelve prime bases, Math. Comp. 86(304):985-1003, 2017. teach primes(6) to enumerate primes up to 2^64 - 1. Until Sorenson and Webster's paper, we did not know how many strong speudoprime tests were required when testing alleged primes between 3825123056546413051 and 2^64 - 1. Adapted from: FreeBSD
Diffstat (limited to 'primes/primes.c')
-rw-r--r--primes/primes.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/primes/primes.c b/primes/primes.c
index 7c874711..a022aa96 100644
--- a/primes/primes.c
+++ b/primes/primes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: primes.c,v 1.21 2014/10/04 13:15:50 wiz Exp $ */
+/* $NetBSD: primes.c,v 1.22 2018/02/03 15:40:29 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0
static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: primes.c,v 1.21 2014/10/04 13:15:50 wiz Exp $");
+__RCSID("$NetBSD: primes.c,v 1.22 2018/02/03 15:40:29 christos Exp $");
#endif
#endif /* not lint */
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
argv += optind;
start = 0;
- stop = SPSPMAX;
+ stop = (uint64_t)(-1);
/*
* Convert low and high args. Strtoumax(3) sets errno to
@@ -145,9 +145,6 @@ main(int argc, char *argv[])
err(1, "%s", argv[1]);
if (*p != '\0')
errx(1, "%s: illegal numeric format.", argv[1]);
- if (stop > SPSPMAX)
- errx(1, "%s: stop value too large (>%" PRIu64 ").",
- argv[1], (uint64_t) SPSPMAX);
break;
case 1:
/* Start on the command line. */