%I #17 Jun 22 2023 17:10:37
%S 1,2,7,3,5,17,11,13,19,101,23,29,31,37,241,41,43,47,53,59,157,61,67,
%T 71,73,79,83,191,89,97,103,107,109,113,127,1019,131,137,139,149,151,
%U 163,167,173,311,179,181,193,197,199,211,223,227,229,277,233,239,251,257,263,269,271,281,283,293,2689
%N Triangle read by rows in which the first row contains a 1 and the n-th row contains n primes not included in the previous rows such that the sum of a row is a perfect square.
%C Another rearrangement of primes and 1.
%e Triangle begins:
%e 1
%e 2 7
%e 3 5 17
%e 11 13 19 101
%e 23 29 31 37 241
%e ...
%p A082737 := proc(nmax) local a,n,r,i,rsum,c,j ; a := [1,2,7] ; n := 3 ; i := 1 ; while nops(a)< nmax do r := [] ; for c from 1 to n-1 do while ithprime(i) in a or ithprime(i) in r do i:= i+1 ; od ; r := [op(r),ithprime(i)] ; i:= i+1 ; od ; j := i+1 ; rsum := sum(op(k,r),k=1..nops(r)) ; while not issqr( rsum+ithprime(j)) do j := j+1 ; od ; r := [op(r),ithprime(j)] ; a := [op(a),op(r)] ; n := n+1 ; od ; RETURN(a) ; end: a := A082737(80) : for n from 1 to nops(a) do printf("%d,",op(n,a)) ; od ; # _R. J. Mathar_, Nov 12 2006
%t A082737[nmax_] := Module[{a, n, r, i, rsum, c, j}, a = {1, 2, 7}; n = 3; i = 1; While[Length[a] <= nmax, r = {}; For[c = 1, c <= n-1, c++, While[MemberQ[a, Prime[i]] || MemberQ[r, Prime[i]], i++]; r = Append[r, Prime[i]]; i++]; j = i+1; rsum = Total[r]; While[!IntegerQ@Sqrt[rsum + Prime[j]], j++]; r = Append[r, Prime[j]]; a = Join[a, r]; n++]; Return[a]];
%t rows = 11;
%t nmax = rows(rows+1)/2;
%t tri = A082737[nmax];
%t T = Table[tri[[(n^2-n+2)/2 ;; n(n+1)/2]], {n, 1, rows}];
%t Table[T[[n, k]], {n, 1, rows}, {k, 1, n}] // Flatten (* _Jean-François Alcover_, Jun 22 2023, after _R. J. Mathar_ *)
%Y Main diagonal gives A082738.
%Y Cf. A008578, A082739, A082740.
%K nonn,tabl
%O 1,2
%A _Amarnath Murthy_, Apr 14 2003
%E More terms from _R. J. Mathar_, Nov 12 2006
%E Last row completed by _Jean-François Alcover_, Jun 22 2023
|