cino hilliard on Thu, 18 Jun 2009 22:13:42 +0200


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

RE: Elliptic curve x^3 - y^2 = p


Hi Karim,
 
> From: Karim.Belabas@math.u-bordeaux1.fr
> Date: Thu, 18 Jun 2009 14:12:36 +0200
> To: pari-users@list.cr.yp.to
> Subject: Re: Elliptic curve x^3 - y^2 = p
>
> * cino hilliard [2009-06-18 12:35]:
> > (05:26:04) gp > ?diffcubes
> > diffcubes(n,p)=local(x,y);setintersect(vector(n,x,x^3-p),vector(n,y,y^2))
> >
> >
> >
> > getting this
> >
> > (05:20:04) gp > diffcubes(10000,431)
> > *** setintersect: not a set in setintersect.
> > also for ver 2.4.2
>
> OK, that's for 2.4.3 only then :-(.
>
> (14:10) gp > ??setintersect
> setintersect(x,y):
>
> intersection of the two sets x and y (see setisset). The function also works
> if both x and y are vectors of stricly increasing entries ( according to < );
> in that case we return a vector of strictly increasing entries, not a set.
> Otherwise, the result is undefined.
Oh boy.
I always get
 
Could not find translation file, docdir='C:/Program Files/PARI' at C:/Program
Files/PARI/gphelp line 152.
 
with  super help ??
 
 
> For "older" versions than that, use
>
> setintersect(Set(vector(n,x,x^3-p)), Set(vector(n,y,y^2)))
>
> ( slower but not *much* slower... )

Bravo!
This does what I want. 
 
 diffcubes(n,p) =
                         {
                        local(j,x,y,c);
                        a=eval(setintersect(Set(vector(n,x,x^3-p)), Set(vector(n,y,y^2))));
                        c=length(a);
                        a=vecsort(a);
                        for(j=1,c,
                        y=round(sqrt(a[j]));
                        x=round((a[j]+p)^(1/3));
                        print(j": "x"^3 - "y"^2 = "p); \\ Too fancy? Change it.
                        );
                        c;
                        }

 
(14:51:50) gp > diffcubes(300000,431)
1: 8^3 - 9^2 = 431
2: 11^3 - 30^2 = 431
3: 20^3 - 87^2 = 431
4: 30^3 - 163^2 = 431
5: 36^3 - 215^2 = 431
6: 138^3 - 1621^2 = 431
7: 150^3 - 1837^2 = 431
8: 575^3 - 13788^2 = 431
9: 3903^3 - 243836^2 = 431
(15:02:35) gp > ##
  ***   last result computed in 2,250 ms.
(15:02:39) gp >
 
This finds all instances because I new a prori 243836 was the big kahuna.
I guess it will still be trial and error?
 
Oh well, we are at least 2 quanta over what I had.
 
 Thank you  >>>
Cino