login
Square array T(n,k) (n>=1, k>=1) read by antidiagonals upwards in which the number entered in a square is the smallest positive number that is different from the numbers already filled in that are queens' or knights' moves away from that square.
7

%I #38 Jun 30 2019 17:49:38

%S 1,2,3,4,5,6,3,7,8,2,5,1,9,4,7,6,2,10,11,1,5,7,4,12,6,3,9,8,8,9,11,13,

%T 2,10,6,4,10,12,1,3,4,7,13,11,9,9,6,2,5,8,1,12,14,3,10,11,13,3,7,6,14,

%U 9,5,1,12,15,12,8,4,14,9,11,10,3,15,2,7,13,13,10,5,1,12,15,2,16,6,4,8,14,11

%N Square array T(n,k) (n>=1, k>=1) read by antidiagonals upwards in which the number entered in a square is the smallest positive number that is different from the numbers already filled in that are queens' or knights' moves away from that square.

%C If we only worry about queens' moves then we get the array in A269526.

%C Presumably, as in A269526, every column, every row, and every diagonal is a permutation of the natural numbers.

%C The knights only affect the squares in their immediate neighborhood, so this array will have very similar properties to A269526. The most noticeable difference is that the first column is no longer A000027, it is now A274631.

%C A piece that can move like a queen or a knight is known as a Maharaja. If we subtract 1 from the entries here we obtain A308201. - _N. J. A. Sloane_, Jun 30 2019

%H N. J. A. Sloane, <a href="/A274630/b274630.txt">Table of n, a(n) for n = 1..10010</a>

%e The array begins:

%e 1, 3, 6, 2, 7, 5, 8, 4, 9, 10, 15, 13, 11, 18, 12, 20, 16, 22, ...

%e 2, 5, 8, 4, 1, 9, 6, 11, 3, 12, 7, 14, 17, 15, 10, 13, 19, 24, ...

%e 4, 7, 9, 11, 3, 10, 13, 14, 1, 2, 8, 5, 6, 16, 22, 17, 21, 12, ...

%e 3, 1, 10, 6, 2, 7, 12, 5, 15, 4, 16, 20, 13, 9, 11, 14, 25, 8, ...

%e 5, 2, 12, 13, 4, 1, 9, 3, 6, 11, 10, 17, 19, 8, 7, 15, 23, 29, ...

%e 6, 4, 11, 3, 8, 14, 10, 16, 13, 1, 2, 7, 15, 5, 24, 21, 9, 28, ...

%e 7, 9, 1, 5, 6, 11, 2, 12, 8, 14, 3, 21, 23, 22, 4, 27, 18, 30, ...

%e 8, 12, 2, 7, 9, 15, 1, 19, 4, 5, 6, 10, 18, 3, 26, 23, 11, 31, ...

%e 10, 6, 3, 14, 12, 4, 5, 9, 11, 7, 1, 8, 16, 13, 2, 24, 28, 20, ...

%e 9, 13, 4, 1, 10, 2, 7, 18, 12, 3, 17, 19, 24, 14, 20, 5, 8, 6, ...

%e 11, 8, 5, 9, 13, 3, 15, 1, 2, 6, 20, 18, 10, 4, 17, 7, 12, 14, ...

%e 12, 10, 7, 18, 11, 6, 4, 8, 14, 9, 5, 15, 21, 2, 16, 26, 3, 13, ...

%e 13, 15, 17, 12, 14, 16, 18, 7, 10, 22, 11, 3, 8, 19, 23, 9, 2, 1, ...

%e 14, 11, 19, 8, 5, 20, 3, 2, 16, 13, 12, 25, 4, 10, 6, 18, 7, 15, ...

%e 16, 18, 21, 10, 15, 13, 11, 17, 5, 8, 9, 6, 7, 30, 25, 28, 20, 19, ...

%e 15, 20, 13, 17, 16, 12, 19, 6, 7, 24, 18, 11, 28, 23, 14, 22, 5, 36, ...

%e 17, 14, 22, 19, 18, 8, 20, 10, 23, 15, 4, 1, 3, 24, 13, 16, 33, 9, ...

%e 18, 16, 23, 24, 25, 26, 14, 13, 17, 19, 22, 9, 5, 6, 8, 10, 15, 27, ...

%e ...

%e Look at the entry in the second cell in row 3. It can't be a 1, because the 1 in cell(1,2) is a knight's move away, it can't be a 2, 3, 4, or 5, because it is adjacent to cells containing these numbers, and there is a 6 in cell (1,3) that is a knight's move away. The smallest free number is therefore 7.

%p # Based on _Alois P. Heinz_'s program for A269526

%p A:= proc(n, k) option remember; local m, s;

%p if n=1 and k=1 then 1

%p else s:= {seq(A(i, k), i=1..n-1),

%p seq(A(n, j), j=1..k-1),

%p seq(A(n-t, k-t), t=1..min(n, k)-1),

%p seq(A(n+j, k-j), j=1..k-1)};

%p # add knights moves

%p if n >= 3 then s:={op(s),A(n-2,k+1)}; fi;

%p if n >= 3 and k >= 2 then s:={op(s),A(n-2,k-1)}; fi;

%p if n >= 2 and k >= 3 then s:={op(s),A(n-1,k-2)}; fi;

%p if k >= 3 then s:={op(s),A(n+1,k-2)}; fi;

%p for m while m in s do od; m

%p fi

%p end:

%p [seq(seq(A(1+d-k, k), k=1..d), d=1..15)];

%t A[n_, k_] := A[n, k] = Module[{m, s}, If[n==1 && k==1, 1, s = Join[Table[ A[i, k], {i, 1, n-1}], Table[A[n, j], {j, 1, k-1}], Table[A[n-t, k-t], {t, 1, Min[n, k]-1}], Table[A[n+j, k-j], {j, 1, k-1}]] // Union; If[n >= 3, AppendTo[s, A[n-2, k+1]] // Union ]; If[n >= 3 && k >= 2, AppendTo[s, A[n-2, k-1]] // Union]; If[n >= 2 && k >= 3, AppendTo[s, A[n-1, k-2]] // Union]; If[k >= 3, AppendTo[s, A[n+1, k-2]] // Union]; For[m = 1, MemberQ[s, m], m++]; m]]; Table[A[1+d-k, k], {d, 1, 15}, {k, 1, d}] // Flatten (* _Jean-François Alcover_, Mar 14 2017, translated from Maple *)

%Y Cf. A269526, A000027.

%Y For first column, row, and main diagonal see A274631, A274632, A274633.

%Y See A308883 for position of 1 in column n.

%Y See A308201 for an essentially identical array.

%K nonn,tabl

%O 1,2

%A _N. J. A. Sloane_ following a suggestion from _Joseph G. Rosenstein_, Jul 07 2016