hermann on Sun, 19 Nov 2023 18:29:39 +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:
So quadratic in p runtime of foursquares() is cool.


What I want is to determine sum of 4 squares for largest known
(Mersenne) prime M_82589933 ;-)

Unfortunately foursquares() projected runtime is 7.25 CPU years ...

Bill,

foursquares() does not only have a runtime problem for going direction of largest Mersenne prime.
It did use 10.5GB RAM short before end of 12:11h run:

top - 23:30:35 up 1 day, 10:06, 3 users, load average: 1.01, 1.00, 1.00
Tasks: 309 total,   2 running, 307 sleeping,   0 stopped,   0 zombie
%Cpu(s): 8.3 us, 0.0 sy, 0.0 ni, 91.4 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st MiB Mem : 15092.2 total, 1162.3 free, 11517.8 used, 2412.1 buff/cache MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 3264.3 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 291352 hermann 20 0 14.0g 10.5g 8960 R 100.0 71.2 727:30.86 gp 445876 hermann 20 0 13552 4480 3584 S 0.2 0.0 0:00.09 top


Since when applying "foursquares()" to a Mersenne prime we know that the first "is_fact()" call is true ...

? isfact(2^756839-1)
1
? ##
  ***   last result computed in 1h, 12min, 11,683 ms.
?

... and takes quite some time, I did directly call foursquares_fact():


? sq=foursquares_fact(2^756839-1);
  ***   at top-level: sq=foursquares_fact(2^756839-1)
  ***                    ^----------------------------
  ***   in function foursquares_fact: abs(
  ***   qfsolve(matdiagonal([1,1,1,1,-n]))[1..4])~
  ***   ^------------------------------------------
  *** qfsolve: the PARI stack overflows !
  current stack size: 15000002560 (14305.117 Mbytes)
  [hint] you can increase 'parisizemax' using default()

  ***   Break loop: type 'break' to go back to GP prompt
break>


How can it be that computing "sq=foursquares(2^756839-1);" worked (which calls foursquares_fact()), and calling
it directly fails?
I have these settings with gp 2.15.4 on 16GB RAM 7600X CPU PC:

hermann@7600x:~$ grep ^parisize /etc/gprc
parisizemax = 15G
parisize = 15G
hermann@7600x:~$