%I #17 Nov 22 2017 03:22:46
%S 5,12,9,16,30,35,40,42,56,33,44,63,60,11,25,32,24,7,10,18,45,28,21,20,
%T 15,8,6,36,27,48,14,55,64,70,72,54,65,75,77,80,39,52,84,13,90,91,96,
%U 99,100,105,88,66,108,81,110,112,117,120,22,50,119,126,128,132,85,135,140
%N a(1) = 5; for n > 1, a(n) is the least k > 0 not already included such that a(m)^2 + k^2 is a square for some m < n.
%C For a(1) = 0,1,2 no possible value of a(2) exists; for a(1) = 3,4 we get 4, 3 for a(2) but no further possible values. For a(1) >= 5 do we always get an infinite sequence?
%C From _Robert Israel_, Nov 22 2017: (Start)
%C Yes: if t >= 5 is the largest of a(1),...,a(n), then (if no smaller k works) it is always possible to take a(n+1) = (t^2-1)/2 if t is odd, t^2/4 - 1 if t is even.
%C Does the sequence include every number >= 5? (End)
%H Robert Israel, <a href="/A066326/b066326.txt">Table of n, a(n) for n = 1..10000</a>
%e a(5) = 30 because a(5)^2 + a(4)^2 = 30^2 + 16^2 = 34^2; a(6) = 35 because a(6)^2 + a(2)^2 = 35^2 + 12^2 = 37^2.
%p Cands:= {5}: S:= {}:
%p for n from 1 to 100 do
%p A[n]:= min(Cands);
%p Cands:= Cands minus {A[n]};
%p if A[n]::odd then divs:= select(`<`,numtheory:-divisors(A[n]^2),A[n])
%p else divs:= select(t -> t < A[n] and t::even and (A[n]^2/t)::even, numtheory:-divisors(A[n]^2))
%p fi;
%p Cands := Cands union (map(t -> (A[n]^2/t - t)/2, divs) minus S);
%p S:= S union {A[n]};
%p od:
%p seq(A[i],i=1..100); # _Robert Israel_, Nov 22 2017
%K nonn,look
%O 1,1
%A Jonathan Ayres (jonathan.ayres(AT)ntlworld.com), Dec 15 2001
%E New name from _Robert Israel_, Nov 22 2017