bin/157177: primes(1) prints non-prime for numbers > 2^32
Kuang-che Wu
kcwu at kcwu.csie.org
Thu May 19 11:30:12 UTC 2011
>Number: 157177
>Category: bin
>Synopsis: primes(1) prints non-prime for numbers > 2^32
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu May 19 11:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Kuang-che Wu
>Release: FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD kcwu.csie.org 9.0-CURRENT FreeBSD 9.0-CURRENT #0: Sun Oct 17 05:01:33 CST 2010 root at kcwu.csie.org:/usr/obj/amd64.amd64/usr/src/sys/DESKTOP amd64
>Description:
primes(1) can generate prime numbers.
However, its prime table (/usr/src/games/primes/pr_tbl.c) contains
primes less than 2^16. And the program didn't generate more prime in
runtime. So it can only determine prime less than 2^32.
For numbers larger than 2^32, it may incorrect print non-prime numbers.
>How-To-Repeat:
$ primes `echo 2^32 | bc -q` | xargs -n 1 factor | grep '[0-9] '
4295360521: 65539 65539
4295622677: 65539 65543
...
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list