Sujet : Re: A very slow program
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 03. Oct 2024, 00:43:45
Autres entêtes
Organisation : None to speak of
Message-ID : <87frpeqg66.fsf@nosuchdomain.example.com>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13)
Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> writes:
[...]
For ordinary users it's probably sufficient to use an existing
program; on Unix 'primes 1 1000000000' runs in about 8 seconds.
And it's checking 2^32 numbers in 50 seconds (including 'wc'
and creating output [suppressed by redirection]), generating
50847534 primes. A simple prime test of some "arbitrary large"
number runs in no time, as does factorization of numbers with
the Unix'es 'factor' program. Just a simple command line call.
That existing 'primes' program also has some limit; the man page
documents a value of 4294967295, but no error message is created
for values up to around 1.8446744*10^19 on my system.
On my system (Ubuntu 22.04.5 LTS, 64 bits), the primes(1) man page says:
"The stop value must not be greater than 3825123056546413050."
4294967295 is of course 2**31-1. I don't know the significance of
3825123056546413050. The change was made by Debian, but the sources
don't explicitly give a reason. Anyone who wants to look into it can
see the patches here:
https://salsa.debian.org/games-team/bsdgames-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */