login
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

%I #24 Feb 26 2021 04:27:16

%S 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,

%T 48,46,9,19,34,50,32,52,56,40,54,60,62,66,68,64,58,70,78,15,17,82,76,

%U 80,72,74,84,88,102,96,90,100,86,106,108,92,114,98,94,110,21,25,116,112,120

%N 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).

%e Square array A(n,k) (with rows n >= 1 and columns k >= 1) begins

%e 1, 3, 5, 6, 7, 13, 9, ...

%e 2, 8, 12, 11, 16, 46, ...

%e 4, 18, 20, 26, 48, ...

%e 10, 24, 22, 36, ...

%e 14, 30, 42, ...

%e 28, 44,

%e 38, ...

%e ...

%e 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.

%e From _Petros Hadjicostas_, Feb 25 2021: (Start)

%e 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.)

%e A(2,1) = 2 because i = 2 > 1, j = 1, and 1 + 2 = 3, which is prime.

%e A(3,1) = 4 because i = 3 > 1, j = 1, and 1 + 2 + 4 = 7, which is prime.

%e 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.)

%e A(1,3) = 5 because i = 1, j = 3 > 1, and 1 + 3 + 5 = 9, which is composite. (End)

%o (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]

%Y Cf. A082224, A082225, A082226, A082227, A082229, A082230, A082231.

%K hard,nonn,tabl

%O 1,2

%A _Amarnath Murthy_, Apr 09 2003

%E Extended by _Max Alekseyev_, Apr 11 2009