Bill Allombert on Wed, 04 Jun 2014 13:17:58 +0200

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

Re: Numbers represented by indefinite binary quad. forms

On Tue, Jun 03, 2014 at 08:45:32PM -0400, Neil Sloane wrote:
> Given an indefinite binary quadratic form ax^2+bxy+cy^2 (with discriminant
> b^2-4ac>0 and not a square) and a number n, how to use PARI to see if
> ax^2+bxy+cy^2=n has a solution?
> [Back in 2003 Bill Alombert said: I have added a new function qfbsolve.
>  qfbsolve(Q,p): Solve  the  equation  Q(x,y)  = p over the integers,  where
> Q is an imaginary binary quadratic form and p a prime number.  Return
>  [x,y]  as a two-components vector,  or zero if there is no solution.  Note
> that this functions return only one solution and not all the solutions.
>  This is a preliminary implementation. I plan to allow non prime p and real
> binary quadratic. Me: Does the "non-prme" version exist? - that would solve
> my problem!

Alas, I implemented the real case, but not the non-prime one.
The algorithm was not optimal in the real case anyway and the combinatoric

I see two way to do it:

-- you can use qfsolve (integrated in PARI 2.8, otherwise available
at <>)

? qfbs(Qfb(1,2,3),123)
%13 = [-12,7,1]~ 
(so the answer is (-12:7:1) in projective coordinate)
This give you a single solution.

-- otherwise, you can use bnfisintnorm() if your discriminant is fundamental.

? qfbs(Qfb(1,2,3),123)
%10 = [[12,1],[-12,-7],[-2,-7],[-10,1]]
(this give all solution modulo units)

if your discriminant is not fundamental, then it is harder.
I wrote a script in 2011 to take care of that:
(be careful, I am not sure it is 100% correct. Report bugs)

? qfbs(Qfb(1,2,3),123)
%7 = [[-10,-1],[10,1],[-2,7],[2,-7],[-12,7],[12,-7],[12,-1],[-12,1]]
(this give all solution modulo non-torsion units)