OFFSET
1,1
COMMENTS
For n > 2, a(n) == (-1)^n (mod 4).
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Robert Israel, Plot of first differences a(n)-a(n-1), odd n in blue, even n in red
EXAMPLE
a(4) = 29 because a(3) + 29 = 6^2 is a square and 29 is the first prime greater than a(2) = 2 that works.
MAPLE
A[1]:= 2: A[2]:= 2: s:= 2:
for i from 3 to 100 do
for s from s+1 while not isprime(s^2 - A[i-1]) do od:
A[i]:= s^2 - A[i-1];
od:
seq(A[i], i=1..100);
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Robert Israel, Jan 08 2023
STATUS
approved