freebsd-dev/games
Colin Percival 535ab8fde8 Correctly enumerate primes between 4295098369 and 3825123056546413050.
Prior to this commit, primes(6) relied solely on sieving with primes up
to 65537, with the effect that composite numbers which are the product
of two non-16-bit primes would be incorrectly identified as prime.  For
example,
# primes 1099511627800 1099511627820
would output
1099511627803
1099511627807
1099511627813
when in fact only the first of those values is prime.

This commit adds strong pseudoprime tests to validate the candidates
which pass the initial sieving stage, using bases of 2, 3, 5, 7, 11,
13, 17, 19, and 23.  Thanks to papers from C. Pomerance, J.L. Selfridge,
and S.S. Wagstaff, Jr.; G. Jaeschke; and Y. Jiang and Y. Deng, we know
that the smallest value which passes these tests is 3825123056546413051.

At present we do not know how many strong pseudoprime tests are required
to prove primality for values larger than 3825123056546413050, so we
force primes(6) to stop at that point.

Reviewed by:	jmg
Relnotes:	primes(6) now correctly enumerates primes up to
		3825123056546413050
MFC after:	7 days
Sponsored by:	EuroBSDCon devsummit
2014-09-26 09:40:48 +00:00
..
bcd bcd isn't installed setuid. 2012-10-22 03:06:53 +00:00
caesar bcd isn't installed setuid. 2012-10-22 03:06:53 +00:00
factor Correctly enumerate primes between 4295098369 and 3825123056546413050. 2014-09-26 09:40:48 +00:00
fortune Update the freebsd-tips example to use drill instead of dig since bind is no longer in base 2014-07-25 14:47:44 +00:00
grdc Replace all uses of libncurses and libtermcap with their wide character 2014-07-17 18:24:34 +00:00
morse use .Mt to mark up email addresses consistently (part1) 2014-06-20 09:40:43 +00:00
number Add static keywords to variables and functions where possible in games/. 2011-11-05 07:18:53 +00:00
pom Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
ppt NO_MAN= has been deprecated in favor of MAN= for some time, go ahead 2014-04-13 05:21:56 +00:00
primes Correctly enumerate primes between 4295098369 and 3825123056546413050. 2014-09-26 09:40:48 +00:00
random use .Mt to mark up email addresses consistently (part1) 2014-06-20 09:40:43 +00:00
tests Add placeholder Kyuafiles for various top-level hierarchies. 2014-04-21 21:39:25 +00:00
Makefile Use src.opts.mk in preference to bsd.own.mk except where we need stuff 2014-05-06 04:22:01 +00:00
Makefile.inc Improve the distributeworld target in Makefile.inc1 and update the release 2011-03-02 14:39:26 +00:00