Dmitriy40, пожалуйста. Пустые строки вставил сейчас, для облегчения чтения:
Код:
GP/PARI CALCULATOR Version 2.17.2 (released)
amd64 running mingw (x86-64/GMP-6.1.2 kernel) 64-bit version
compiled: Feb 28 2025, gcc version 12-posix (GCC)
threading engine: pthread, nbthreads = 12
(readline not compiled in, extended help enabled)
Copyright (C) 2000-2024 The PARI Group
PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER.
Type ? for help, \q to quit.
Type ?18 for how to get moral (and possibly technical) support.
parisize = 8000000, primelimit = 1048576, factorlimit = 1048576
? {\\default(nbthreads,1);
nth=default(nbthreads); stop=precprime(10^8); export(stop,nth); t0=getwalltime(); n=0;
parfor(th=1,nth, my(x,y=0,a); forstep(a=th,stop-1,nth, if(ispseudoprime(lift(chinese(Mod(1,9699690),Mod(a,stop)))), y++); ); y, r,n+=r);
print("n=",n,"/",stop-1,", nth=",nth,", time: ",strtime(getwalltime()-t0));}
n=17468130/99999988, nth=12, time: 52,220 ms
? {default(nbthreads,1);
nth=default(nbthreads); stop=precprime(10^8); export(stop,nth); t0=getwalltime(); n=0;
parfor(th=1,nth, my(x,y=0,a); forstep(a=th,stop-1,nth, if(ispseudoprime(lift(chinese(Mod(1,9699690),Mod(a,stop)))), y++); ); y, r,n+=r);
print("n=",n,"/",stop-1,", nth=",nth,", time: ",strtime(getwalltime()-t0));}
n=17468130/99999988, nth=1, time: 4min, 52,538 ms
?