Bill Allombert on Fri, 20 May 2016 15:20:17 +0200


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

Re: What am I doing wrong?


On Fri, May 20, 2016 at 02:28:51PM +0200, Dirk Laurie wrote:
> 2016-05-20 14:21 GMT+02:00 Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>:
> > On Fri, May 20, 2016 at 01:59:14PM +0200, Dirk Laurie wrote:
> >> % qfbsolve(Qfb(1,0,-5),4)
> >> %2 = 0
> >>
> >> Why are the solutions x=3,y=1; x=7,y=3; x=18,y=8; etc not found?
> >
> > Because 4 is not prime:
> >
> > ? ?qfbsolve
> > qfbsolve(Q,p): Return [x,y] so that Q(x,y)=p where Q is a binary
> > quadratic form and p a prime
> > number, or 0 if there is no solution.
> 
> Follow-up question: can Pari handle equations like x^2 - 5*y^2 = 4
> directly, or must I write the code exploiting Diophantine approximation
> of sqrt(5) by hand?

This is complicated.
We provide the function bnfisinitnorm that does what you want, with a
caveats: it returns solution in the maximal order Z[(1+sqrt(5))/2]
instead of Z[sqrt(5)].

? bnfisintnorm(bnfinit(x^2-5),4)
%1 = [2]

Cheers,
Bill.