login
A082228
In the following square array A(n,k), numbers (not occurring earlier) are entered like this, A(1, 1), A(1, 2), A(2, 1), A(3, 1), A(2, 2), A(1, 3), A(1, 4), A(2, 3), A(3, 2), A(4, 1), A(5, 1), A(4, 2), ... such that every partial sum (of length > 1) of the rows is composite and every partial sum (of length > 1) of the columns is prime. The sequence contains the terms in the order in which they are entered (with A(1,1) = 1).
8
1, 3, 2, 4, 8, 5, 6, 12, 18, 10, 14, 24, 20, 11, 7, 13, 16, 26, 22, 30, 28, 38, 44, 42, 36, 48, 46, 9, 19, 34, 50, 32, 52, 56, 40, 54, 60, 62, 66, 68, 64, 58, 70, 78, 15, 17, 82, 76, 80, 72, 74, 84, 88, 102, 96, 90, 100, 86, 106, 108, 92, 114, 98, 94, 110, 21, 25, 116, 112, 120
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]
KEYWORD
hard,nonn,tabl
AUTHOR
Amarnath Murthy, Apr 09 2003
EXTENSIONS
Extended by Max Alekseyev, Apr 11 2009
STATUS
approved