%I #17 May 05 2021 17:02:24
%S 1,2,1,2,3,1,5,6,7,8,9,5,2,12,13,1,15,16,17,3,5,20,2,22,23,8,4,26,12,
%T 3,29,30,1,5,33,34,4,36,37,15,6,29,22,5,43,19,45,7,15,48,6,50,11,52,8,
%U 41,22,7,57,58,59,9,26,62,8,64,19,66,10,68,5,9,71,2
%N Least positive k such that triangular(n) + triangular(k) is a square.
%C Triangular(k) = A000217(k) = k*(k+1)/2.
%C For n>1, a(n) <= n-1, because with k=n-1: triangular(n) + triangular(k) = n*(n+1)/2 + (n-1)*n/2 = n^2.
%t Table[k = 1; tri = n*(n + 1)/2; While[k <= n+2 && ! IntegerQ[Sqrt[tri + k*(k + 1)/2]], k++]; k, {n, 0, 100}] (* _T. D. Noe_, Nov 21 2013 *)
%o (Python)
%o import math
%o for n in range(77):
%o tn = n*(n+1)//2
%o for k in range(1, n+9):
%o sum = tn + k*(k+1)//2
%o r = int(math.sqrt(sum))
%o if r*r == sum:
%o print(str(k), end=',')
%o break
%Y Cf. A000217, A000290.
%Y Cf. A082183 (least k>0 such that triangular(n) + triangular(k) is a triangular number).
%Y Cf. A212614 (least k>1 such that triangular(n) * triangular(k) is a triangular number).
%Y Cf. A232176 (least k>0 such that n^2 + triangular(k) is a square).
%Y Cf. A232179 (least k>=0 such that n^2 + triangular(k) is a triangular number).
%Y Cf. A101157 (least k>0 such that triangular(n) + k^2 is a triangular number).
%Y Cf. A232178 (least k>=0 such that triangular(n) + k^2 is a square).
%K nonn
%O 0,2
%A _Alex Ratushnyak_, Nov 20 2013