Bill Allombert on Thu, 16 Nov 2023 23:28:32 +0100


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

Re: Question on ternary quadratic form


On Thu, Nov 16, 2023 at 01:54:50PM -0800, American Citizen wrote:
> Hermann:
> 
> I might be interested in your code. In the past from Bill, I got for 2
> squares for N
> 
> > {sqs2(N)=
> > local(L,i,R);
> > L=abs(qfbsolve(Qfb(1,0,1),N,3));
> > for(i=1,matsize(L)[2],L[i]=vecsort(L[i],,4));
> > R=Set(L);
> > return(R);
> > }
> but then for 3 squares, I created a loop from 1 to sqrt(N) and subtracted
> the square of that loop value from N and checked for a solution for 2
> squares.
> 
> would your method be quicker?

If you want all the solutions, no, there are too many of them.
If you need only one solution, you can use my script
<https://pari.math.u-bordeaux.fr/Scripts/foursquares.gp>

Cheers,
Bill.