| Bill Allombert on Tue, 03 Oct 2023 10:46:01 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: How to generate wolframscript "PowersRepresentations[...]" output in PARI/GP |
On Tue, Oct 03, 2023 at 09:31:12AM +0200, hermann@stamm-wilbrandt.de wrote: > On 2023-10-02 20:54, Bill Allombert wrote: > > > > If you want only one solution, you can do > > > > foursquare(n) = abs(qfsolve(matdiagonal([1,1,1,1,-n]))[1..4]); > > > > ? foursquare(17*29) > > %15 = [0,0,13,18]~ > > > > ? foursquare(2^127-1) > > %13 = > > [3485713606461563310,6176908041673972933,4510469025815889567,9974590734764851407]~ > > > Thank you, that is fast and cool. > > I tried qfsolve() on bigger numbers, and asked myself whether pari lib > and C could speed up computation. > > I looked at the 37 hits for "solve" in manual: > https://pari.math.u-bordeaux.fr/pub/pari/manuals/2.15.4/libpari.pdf > > I found qfbsolve() and cornacchia(), but nothing I could match to GP > qfsolve(). > Is qfsolve() only available for GP? Of course not: ? ??qfsolve qfsolve(G): ... The library syntax is GEN qfsolve(GEN G). Cheers, Bill.