Karim BELABAS on Wed, 20 Jan 1999 18:17:16 +0100 (MET) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Bug in ellap (?) |
[Francois Morain:] > I have found a strange thing about ellap. As is well known, when > E:Y^2=X^3+aX with p = 3 mod 4, then ap = 0. Yet, trying the following: > > {bug(nmin, nmax, p)= > for(n = nmin, nmax, > p = 10^n+3; > while(isprime(p) == 0, p = p+4); > print("n=", n, " p=", p, " -> ",ellap(ellinit([0,0,0,2,0]),p)); > ); > } the following looks slightly better (needs 2.0.13). {bug(nmin, nmax)= local(e, p); e = ellinit([0,0,0,2,0]); for(n = nmin, nmax, p = 10^n+3; while(!isprime(p), p += 4); print("n=" n "\tp=" p "\t-> " ellap(e,p)); ); } > I got: [...] > ? bug(2, 20) [...] > n=10 p=10000000019 -> 1 > [...] > What happened? Off-by-1 error... > Any idea? Related to p getting too large (> 2^31)??? Yup, a different routine gets called if p < 0x3fffffff Karim. *** src/modules/elliptic.c.orig Tue Dec 15 16:30:35 1998 --- src/modules/elliptic.c Wed Jan 20 18:00:20 1999 *************** *** 1577,1583 **** h=addii(h,mulsi(j2,bcon)); p2=mulsi(s,mulsi(com,bcon)); h=(egalii(gmael(p1,2,2),gmael(ftest,2,2))) ? subii(h,p2) : addii(h,p2); } ! else h=addii(h,mulsi(i-1,bcon)); p2=factor(h); p1=(GEN)p2[1]; p2=(GEN)p2[2]; for (i=1; i<lg(p1); i++) --- 1577,1583 ---- h=addii(h,mulsi(j2,bcon)); p2=mulsi(s,mulsi(com,bcon)); h=(egalii(gmael(p1,2,2),gmael(ftest,2,2))) ? subii(h,p2) : addii(h,p2); } ! else h=addii(h,mulsi(i,bcon)); p2=factor(h); p1=(GEN)p2[1]; p2=(GEN)p2[2]; for (i=1; i<lg(p1); i++) -- Karim Belabas email: Karim.Belabas@math.u-psud.fr Dep. de Mathematiques, Bat. 425 Universite Paris-Sud Tel: (00 33) 1 69 15 57 48 F-91405 Orsay (France) Fax: (00 33) 1 69 15 60 19 -- PARI/GP Home Page: http://pari.home.ml.org