hermann on Fri, 17 Nov 2023 00:10:15 +0100


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

Re: Question on ternary quadratic form


On 2023-11-16 23:28, Bill Allombert wrote:

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.

I think your "threesquares()" in that script is faster than American Citizen's code.


But I determined sum of 4 squares for Mersenne primes M_p=2^p-1
(they do not have sum of 3 squares representation).

Your "foursquares()" takes 21ms for M_1279.
But I had to stop it after more than an hour for M_2203 on i7-11850H CPU.

Latest tqf.gp gist
https://gist.github.com/Hermann-SW/f13b8adf7d7e3094f0b6db0bce29a7b8
takes less than 1s for M_p with p<=9689(!).

For bigger Mersenne primes find runtime table here:
https://gist.github.com/Hermann-SW/f13b8adf7d7e3094f0b6db0bce29a7b8?permalink_comment_id=4763152#gistcomment-4763152
(as well as next tuning step for processing even larger Mersenne primes)

Regards,

Hermann.