login
A360061
Lexicographically earliest increasing sequence such that a(1) = 2 and for n >= 2, a(1)^2 + a(2)^2 + ... + a(n)^2 is a prime.
1
2, 3, 4, 12, 48, 54, 66, 138, 144, 162, 168, 180, 198, 234, 252, 264, 330, 360, 366, 372, 402, 420, 444, 462, 480, 534, 546, 552, 564, 576, 600, 630, 642, 678, 702, 744, 756, 846, 852, 858, 882, 966, 1008, 1206, 1242, 1254, 1266, 1272, 1296, 1302, 1338, 1650
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
Sequence in context: A053350 A165302 A276530 * A251411 A117342 A328210
KEYWORD
easy,nonn
AUTHOR
Win Wang, Jan 23 2023
STATUS
approved