OFFSET
1,2
MAPLE
A082738 := proc(nmax) local T, a, n, r, i, rsum, c, j ; T := [1, 2, 7] ; a := [1, 7] ; n := 3 ; i := 1 ; while nops(a)< nmax do r := [] ; for c from 1 to n-1 do while ithprime(i) in T 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 ; a := [op(a), ithprime(j)] ; r := [op(r), ithprime(j)] ; T := [op(T), op(r)] ; n := n+1 ; od ; RETURN(a) ; end: a := A082738(80) : for n from 1 to nops(a) do printf("%d, ", op(n, a)) ; od ; # R. J. Mathar, Nov 12 2006
MATHEMATICA
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]];
rows = 43;
nmax = rows (rows + 1)/2;
tri = A082737[nmax];
T = Table[tri[[(n^2 - n + 2)/2 ;; n (n + 1)/2]], {n, 1, rows}];
a[n_] := T[[n, -1]];
Table[a[n], {n, 1, rows}] (* Jean-François Alcover, Jun 10 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Apr 14 2003
EXTENSIONS
More terms from R. J. Mathar, Nov 12 2006
STATUS
approved