hermann on Sun, 19 Nov 2023 01:29:37 +0100


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

Re: foursquares.gp


On 2023-11-19 00:28, hermann@stamm-wilbrandt.de wrote:
Bill did develop and tuned foursquares.gp based on this thread:
https://pari.math.u-bordeaux.fr/archives/pari-users-2310/msg00003.html

You can find foursquares.gp in contributed GP scripts section:
https://pari.math.u-bordeaux.fr/Scripts/
https://pari.math.u-bordeaux.fr/Scripts/foursquares.gp


It does outperform my approach based on ternary quadratic forms to
determine sum of 3 suqares as of now by far:
https://pari.math.u-bordeaux.fr/archives/pari-users-2311/msg00018.html

I had a hard time to find any example where ternary quadratic form "squares34()" outperforms Bill's "foursquares()". Here is one; I determined RSA-480 as largest unfactored RSA number =7 (mod 8) and used that:

hermann@7600x:~/RSA_numbers_factored/pari$ gp -q foursquares.gp tqf.gp RSA_numbers_factored.gp
? foreach(RSA.unfactored(3),r,print1(r[1]," "))
260 270 896 290 300 1024 330 350 380 410 420 440 480 490
? n=RSA.get(490)[2];
? n%8
3
? n=RSA.get(480)[2];
? n%8
7
? sq=squares34(n);
? ##
  ***   last result computed in 6 ms.
? #sq
4
? norml2(sq)==n
1
? sq=foursquares(n);
? ##
  ***   last result computed in 52 ms.
? #sq
4
? norml2(sq)==n
1
?

Regaards,

Hermann.