Commit Graph

11 Commits

Author SHA1 Message Date
Colin Percival
eb5ea45ba8 Switch primes(6) from using unsigned long to using uint64_t. This fixes
'limited range of type' warnings about comparisons on 32-bit systems, and
allows 32-bit systems to compute the full range of primes.
2014-09-27 09:00:38 +00:00
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
Ulrich Spörlein
dfc0276185 Drop advertising clause in manpages. It was done a long time ago
for the source code.

Discussed with:	core
2010-12-06 19:12:51 +00:00
Ruslan Ermilov
8fea899f6b mdoc(7) police: sweep. 2002-11-29 16:21:33 +00:00
Tony Finch
bc71591d79 Mdocify and fix a load of errors dating back to the dawn of time.
Don't mention hard limits for factor(6) since it now has bignum support.

Obtained from:	NetBSD (mdoc only -- their man page is still mostly wrong)
2002-10-09 20:00:25 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Peter Wemm
9b7a44a60e $Id$ -> $FreeBSD$ 1999-08-27 23:37:10 +00:00
Warner Losh
4c00dd8215 Minor adjustments to prior commits:
o break at end of sentences
	o add $id$
	o change date

Noticed by: the ever watchful bde
1999-01-07 22:09:05 +00:00
Warner Losh
63f8ec6b73 Fix printf errors in the hflag case.
Fix old bug with bogus casing to (long).
Document the true limits of factor on 64-bit architectures.

Submitted by: bde
1999-01-06 19:46:56 +00:00
Warner Losh
be47d628ca added -h flag to allow for hexidecimal output.
Use '0' for base rather than 10 to allow for more flexible input bases.

Inspired by changes in PR 7402, but mostly redone by me to get past
bde filter.

Submitted by: Timo J. Rinne
PR: 7402
1999-01-06 08:14:26 +00:00
Jordan K. Hubbard
554eb505f8 Bring in the 4.4 Lite games directory, modulo man page changes and segregation
of the x11 based games.  I'm not going to tag the originals with bsd_44_lite
and do this in two stages since it's just not worth it for this collection,
and I've got directory renames to deal with that way.  Bleah.
Submitted by:	jkh
1994-09-04 04:03:31 +00:00