OFFSET
1,2
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):=1:
seq(a(n), n=1..52); # Alois P. Heinz, Jan 26 2023
MATHEMATICA
s[n_] := s[n] = If[n < 1, 0, a[n]^2 + s[n-1]];
a[n_] := a[n] = Module[{k, m}, k = s[n-1]; For[m = 1 + a[n-1], !PrimeQ[k + m^2], m++]; m];
a[1] = 1;
Table[a[n], {n, 1, 52}] (* Jean-François Alcover, Feb 12 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Apr 07 2008
STATUS
approved