OFFSET
1,2
EXAMPLE
Square array A(n,k) (with rows n >= 1 and columns k >= 1) begins
1, 3, 5, 6, 7, 13, 9, ...
2, 8, 12, 11, 16, 46, ...
4, 18, 20, 26, 48, ...
10, 24, 22, 36, ...
14, 30, 42, ...
28, 44,
38, ...
...
E.g., the third partial sum of the second row is 2 + 8 + 12 = 22, which is composite, while the same for the second column is 3 + 8 + 18 = 29, which is prime.
From Petros Hadjicostas, Feb 25 2021: (Start)
A(1,2) = 3 because i = 1, j = 2 > 1, and 1 + 3 = 4, which is composite. (The number 2 has been rejected because 1 + 2 = 3, which is prime.)
A(2,1) = 2 because i = 2 > 1, j = 1, and 1 + 2 = 3, which is prime.
A(3,1) = 4 because i = 3 > 1, j = 1, and 1 + 2 + 4 = 7, which is prime.
A(2,2) = 8 because i = j = 2 > 1, 2 + 8 = 10, which is composite, while 3 + 8 = 11, which is prime. (The number 5 has been rejected because 2 + 5 = 7, which is prime; the number 6 has been rejected because 3 + 6 = 9, which is composite; and 7 has been rejected because 3 + 7 = 10, which is composite.)
A(1,3) = 5 because i = 1, j = 3 > 1, and 1 + 3 + 5 = 9, which is composite. (End)
PROG
(PARI) lista(nn) = { my(A=matrix(nn, nn)); S=Set(); for(s=2, nn+1, for(i=1, s-1, if(s%2, q=[i, s-i], q=[s-i, i]); p=[sum(j=1, q[2]-1, A[q[1], j]), sum(j=1, q[1]-1, A[j, q[2]])]; n=1; while(setsearch(S, n) || (p[1]&&isprime(p[1]+n)) || (p[2]&&!isprime(p[2]+n)), n++); A[q[1], q[2]]=n; S=setunion(S, Set([n])); print1(n, ", "); )) } \\ Max Alekseyev, Apr 11 2009 [Slightly edited by Petros Hadjicostas, Feb 25 2021]
CROSSREFS
KEYWORD
AUTHOR
Amarnath Murthy, Apr 09 2003
EXTENSIONS
Extended by Max Alekseyev, Apr 11 2009
STATUS
approved