OFFSET
1,1
EXAMPLE
For n >= 2, partial sums of squares are (showing primality): 2^2 + 3^2 = 13; 13 + 4^2 = 29; 29 + 12^2 = 173; 173 + 48^2 = 2477; ...
MAPLE
s:= proc(n) option remember; `if`(n<1, 0, a(n)^2+s(n-1)) end:
a:= proc(n) option remember; local k, m;
k:= s(n-1); for m from 1+a(n-1)
while not isprime(k+m^2) do od; m
end: a(1):=2:
seq(a(n), n=1..52); # Alois P. Heinz, Jan 26 2023
PROG
(Haskell)
import Math.NumberTheory.Primes.Testing (isPrime)
a360061_list = 2 : 3 : recurse 4 13 where
recurse n p
| isPrime(n^2 + p) = n : recurse (n+1) (n^2 + p)
| otherwise = recurse (n+1) p
-- Peter Kagey, Jan 25 2023
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Win Wang, Jan 23 2023
STATUS
approved