Karim Belabas on Sat, 20 Jan 2024 17:08:42 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Bug#2531: the bug in forprimestep()


* Ilya Zakharevich [2024-01-20 13:48]:
> On Sat, Jan 20, 2024 at 12:35:40PM +0100, Karim Belabas wrote:
> > 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
> 
> Millions of thanks!
> 
> Can you describe in which contexts this bug is NOT HIT in the old
> code — so one can try to squeeze some use from the production builds?

forprimestep(p = a, b, q or Mod(c,q), ...) was a priori OK if a >= 0 and
a - q >= 0, and q fit in an ulong.

I just improved the implementation to support arbitrary positive q:

(16:59) gp > forprimestep(p=1, oo, 2^128, print(p))
7145929705339707732730866756067132440577
14291859410679415465461733512134264881153
37771342728224169444434581424926271471617
41854731131275431005995076714107490009089
44236707699722000250238698966129867489281
[...]

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/