| Karim Belabas on Sat, 20 Jan 2024 12:35:45 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: forprimestep 50000 times slower than needed |
* Ilya Zakharevich [2024-01-20 02:30]:
> On Sun, Jan 07, 2024 at 10:51:55PM +0100, Loïc Grenié wrote:
> > On a related note, I observe that
> > ? my(n=8);forprimestep(p=nextprime(10^8),10^8+10^n,10^n,print(p))
> > 100000007
> > ? my(n=9);forprimestep(p=nextprime(10^8),10^8+10^n,10^n,print(p))
> > ?
> >
> > while I would have expected both lines to print 100000007.
>
> Oups — I did not recheck this — and I was hit by this bug on “the
> final pre-production step”!!! Fortunately, I had a (vague) memory of
> you reporting this, which helped to reduce debugging to ∼1 hour…
>
> Reported: https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2531
Had analyzed this last week (related to initial value being negative
or becoming negative during the initialization), but hadn't found a
good way to solve it then. Had another go at it today; the problem
should be fixed in master now
? my(n=8);forprimestep(p=nextprime(10^8),10^8+10^n,10^n,print(p))
100000007
? my(n=9);forprimestep(p=nextprime(10^8),10^8+10^n,10^n,print(p))
100000007
? my(p0=1500301459763,step=4907262314955);if(isprime(p0),print("Prime "p0));forprimestep(p=p0,2e14,step,print(p))
Prime 1500301459763
1500301459763
21129350719583
60387449239223
109460072388773
? my(p0=1500301459763,step=4907262314955);if(isprime(p0),print("Prime "p0));forprimestep(p=p0-step,2e14,step,print(p))
Prime 1500301459763
1500301459763
21129350719583
60387449239223
109460072388773
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/