%I #29 Sep 16 2017 00:35:59
%S 1,8,8,2,2,2,3,22,78,4,21,60,5,20,44,6,19,30,7,2,2,8,1,8,9,40,216,10,
%T 39,186,11,38,158,12,37,132,13,36,108,14,2,2,15,34,66,16,33,48,17,8,8,
%U 18,7,18,19,6,30,20,5,44,21,4,60,22,3,78,23,2,2,24
%N Array A(n,k), n > 0, k=1,2,3, read by rows such that A(n,i) + A(n,j) is a square for i <> j with A(n,1) = n.
%C Problem No. 40 from P. Erdős (see the first reference). The problem is "can we find for each positive integer k, k integers a1, a2, ..., ak such that the sums ai + aj are squares?” This problem is possible for k <= 4.
%C In this sequence we consider k = 3, a1 = n and a2 minimum.
%H Michel Lagneau, <a href="/A224875/b224875.txt">Table of triples (n, b, c) for n = 1..1000</a>
%H P. Erdős, <a href="http://www.renyi.hu/~p_erdos/1961-22.pdf">Some unsolved problems</a>, Publ. Inst. Hung. Acad. Sci. 6 (1961), 221-259.
%H P. Erdős, <a href="http://www.renyi.hu/~p_erdos/1963-14.pdf">Quelques problèmes de théorie des nombres</a> (in French), Monographies de l'Enseignement Mathématique, No. 6, pp. 81-135, L'Enseignement Mathématique, Université, Geneva, 1963.
%e Array A(n,k) begins:
%e [1, 8, 8]
%e [2, 2, 2]
%e [3, 22, 78]
%e [4, 21, 60]
%e [5, 20, 44]
%e ...
%e Row 4 = [4, 21, 60] because 4 + 21 = 5^2, 4 + 60 = 8^2 and 21 + 60 = 9^2.
%p with(numtheory): T:=array(1..121):k:=1:nn:=121:C:=array(1..nn):for i from 1 to nn do:C[i]:=i^2:od:for n from 1 to nn do:ii:=0:for a from 1 to nn while(ii=0) do: aa:=C[a]-n: for b from 1 to nn while(ii=0) do: bb:=C[b]-n:if aa>0 and bb>0 and sqrt(aa+bb)=floor(sqrt(aa+bb)) then ii:=1:T[k]:=n: T[k+1]:=aa: T[k+2]:=bb:k:=k+3:else fi:od:od:od:print(T):
%K nonn,tabf
%O 1,2
%A _Michel Lagneau_, Jul 23 2013