%I #31 Sep 14 2021 03:50:04
%S 1,2,1,6,12,27,19,31,64,48,96,72,1,26,28,15,3,26,24,24,48,64,44,35,48,
%T 96,108,151,131,223,447,831,639,190,380,299,507,663,1212,904,209,7,36,
%U 104,17,87,116,211,264,264,165,103,143,151,204,303,536,1055,860,1688,3156,2592,1341,1399
%N a(0) = 1; for n>0, a(n) is the smallest positive integer such that a(n-1)^2 + n^2 + a(n) is a square.
%C 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.
%H Seiichi Manyama, <a href="/A347594/b347594.txt">Table of n, a(n) for n = 0..10000</a>
%e a(1) = 2 as a(0)^2 + 1^2 = 1 + 1 = 2, and 2 + 2 = 4 = 2^2 is the next smallest square.
%e a(2) = 1 as a(1)^2 + 2^2 = 4 + 4 = 8, and 8 + 1 = 9 = 3^2 is the next smallest square.
%e a(60) = 3156 as a(59)^2 + 60^2 = 2849344 + 3600 = 2852944, and 2852944 + 3156 = 2856100 = 1690^2 is the next smallest square.
%t 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 *)
%o (Python)
%o from math import isqrt
%o A347594_list = [1]
%o for n in range(1,10**3):
%o m = A347594_list[n-1]**2+n**2
%o A347594_list.append((isqrt(m)+1)**2-m) # _Chai Wah Wu_, Sep 12 2021
%o (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
%Y Cf. A000290, A103605, A009000, A005408, A347754.
%K nonn,look
%O 0,2
%A _Scott R. Shannon_, Sep 08 2021
|