Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Last active January 10, 2026 14:50
Show Gist options
  • Select an option

  • Save Hermann-SW/fe69d723ddc2b8b6ff7666b747aad1aa to your computer and use it in GitHub Desktop.

Select an option

Save Hermann-SW/fe69d723ddc2b8b6ff7666b747aad1aa to your computer and use it in GitHub Desktop.
Script to verify a(11) for oeis sequence A392244
a(n)=parsum(k=1, 10^n, isprime(k^2+(k+1)^2));
default(threadsizemax,100*10^6); \\ default 8MB was too small
#
print(a(11));
@Hermann-SW
Copy link
Author

Hermann-SW commented Jan 10, 2026

Started with nohup numactl -C 0-191 gp -q < a11.gp, expected runtime <10h real time

@Hermann-SW
Copy link
Author

Hermann-SW commented Jan 10, 2026

top output after 60.55h/192 = 19min real time:

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND  
  36942 hermann   20   0   30.1g   1.9g   8040 S 19208   0.2     60,55 gp       

@Hermann-SW
Copy link
Author

Computation with 8MB default threadsizemax ...

? default(threadsizemax)
0
? 

... stopped after 4.5h:

hermann@x3950-X6:~$ cat nohup.out.stacksize 
   timer = 1 (on)
  ***   at top-level: print(a(11))
  ***                       ^------
  ***   in function a: parsum(k=1,10^n,isprime(k^2+(k+1)^2))
  ***                  ^-------------------------------------
  *** parsum: the thread stack overflows !
  current stack size: 8000000 (7.629 Mbytes)
  [hint] set 'threadsizemax' to a nonzero value in your GPRC

hermann@x3950-X6:~$ 

New revision tries to compensate.

Again started with nohup numactl -C 0-191 gp -q < a11.gp.

top after 35.25h/192 = 11min real time:

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND  
  41184 hermann   20   0   63.0g   1.9g   8192 S 19193   0.2     35,25 gp       

@Hermann-SW
Copy link
Author

Started with nohup numactl -C 0-191 gp -q < a11.gp, expected runtime <10h real time

Wow, I expected <10h, but not that much under, nice:

hermann@x3950-X6:~$ sed "s/\xd/\n/g" nohup.out
   timer = 1 (on)
  *** isprime: Warning: increasing stack size to 16000000.
  *** isprime: Warning: increasing stack size to 32000000.
  *** isprime: Warning: increasing stack size to 64000000.
5573589175
cpu time = 1110h, 34min, 16,003 ms, real time = 5h, 47min, 8,619 ms.
hermann@x3950-X6:~$ 

Confirms a(11) value of A392244 computed otherwise before:
https://gist.github.com/Hermann-SW/94241e719dd3518a3276d804b627319d?permalink_comment_id=5929893#gistcomment-5929893
That code did take 14:28h real time, but only because the parallel workload was distributed too unequally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment