OFFSET
0,2
COMMENTS
In the first one million terms the largest value is a(987016) = 123592518669. In this range the smallest number that has not yet appeared is 9.
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000
EXAMPLE
a(1) = 2 as a(0)^2 + 1^2 = 1 + 1 = 2, and 2 + 2 = 4 = 2^2 is the next smallest square.
a(2) = 1 as a(1)^2 + 2^2 = 4 + 4 = 8, and 8 + 1 = 9 = 3^2 is the next smallest square.
a(60) = 3156 as a(59)^2 + 60^2 = 2849344 + 3600 = 2852944, and 2852944 + 3156 = 2856100 = 1690^2 is the next smallest square.
MATHEMATICA
Nest[Append[#, Block[{k = 1, m = Last[#1]}, While[! IntegerQ@ Sqrt[#2^2 + m^2 + k], k++]; k]] & @@ {#, Length@ #} &, {1}, 63] (* Michael De Vlieger, Sep 08 2021 *)
PROG
(Python)
from math import isqrt
A347594_list = [1]
for n in range(1, 10**3):
m = A347594_list[n-1]**2+n**2
A347594_list.append((isqrt(m)+1)**2-m) # Chai Wah Wu, Sep 12 2021
(PARI) lista(nn) = {my(prec = 1, list=List()); listput(list, prec); for (n=1, nn, my(k = 1); while (!issquare(prec^2+n^2+k), k++); listput(list, k); prec = k; ); Vec(list); } \\ Michel Marcus, Sep 13 2021
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Scott R. Shannon, Sep 08 2021
STATUS
approved