A274630 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.
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, 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, 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
Offset: 1
Examples
The array begins: 1, 3, 6, 2, 7, 5, 8, 4, 9, 10, 15, 13, 11, 18, 12, 20, 16, 22, ... 2, 5, 8, 4, 1, 9, 6, 11, 3, 12, 7, 14, 17, 15, 10, 13, 19, 24, ... 4, 7, 9, 11, 3, 10, 13, 14, 1, 2, 8, 5, 6, 16, 22, 17, 21, 12, ... 3, 1, 10, 6, 2, 7, 12, 5, 15, 4, 16, 20, 13, 9, 11, 14, 25, 8, ... 5, 2, 12, 13, 4, 1, 9, 3, 6, 11, 10, 17, 19, 8, 7, 15, 23, 29, ... 6, 4, 11, 3, 8, 14, 10, 16, 13, 1, 2, 7, 15, 5, 24, 21, 9, 28, ... 7, 9, 1, 5, 6, 11, 2, 12, 8, 14, 3, 21, 23, 22, 4, 27, 18, 30, ... 8, 12, 2, 7, 9, 15, 1, 19, 4, 5, 6, 10, 18, 3, 26, 23, 11, 31, ... 10, 6, 3, 14, 12, 4, 5, 9, 11, 7, 1, 8, 16, 13, 2, 24, 28, 20, ... 9, 13, 4, 1, 10, 2, 7, 18, 12, 3, 17, 19, 24, 14, 20, 5, 8, 6, ... 11, 8, 5, 9, 13, 3, 15, 1, 2, 6, 20, 18, 10, 4, 17, 7, 12, 14, ... 12, 10, 7, 18, 11, 6, 4, 8, 14, 9, 5, 15, 21, 2, 16, 26, 3, 13, ... 13, 15, 17, 12, 14, 16, 18, 7, 10, 22, 11, 3, 8, 19, 23, 9, 2, 1, ... 14, 11, 19, 8, 5, 20, 3, 2, 16, 13, 12, 25, 4, 10, 6, 18, 7, 15, ... 16, 18, 21, 10, 15, 13, 11, 17, 5, 8, 9, 6, 7, 30, 25, 28, 20, 19, ... 15, 20, 13, 17, 16, 12, 19, 6, 7, 24, 18, 11, 28, 23, 14, 22, 5, 36, ... 17, 14, 22, 19, 18, 8, 20, 10, 23, 15, 4, 1, 3, 24, 13, 16, 33, 9, ... 18, 16, 23, 24, 25, 26, 14, 13, 17, 19, 22, 9, 5, 6, 8, 10, 15, 27, ... ... 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.
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..10010
Crossrefs
Programs
-
Maple
# Based on Alois P. Heinz's program for A269526 A:= proc(n, k) option remember; local m, s; if n=1 and k=1 then 1 else s:= {seq(A(i, k), i=1..n-1), seq(A(n, j), j=1..k-1), seq(A(n-t, k-t), t=1..min(n, k)-1), seq(A(n+j, k-j), j=1..k-1)}; # add knights moves if n >= 3 then s:={op(s),A(n-2,k+1)}; fi; if n >= 3 and k >= 2 then s:={op(s),A(n-2,k-1)}; fi; if n >= 2 and k >= 3 then s:={op(s),A(n-1,k-2)}; fi; if k >= 3 then s:={op(s),A(n+1,k-2)}; fi; for m while m in s do od; m fi end: [seq(seq(A(1+d-k, k), k=1..d), d=1..15)];
-
Mathematica
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 *)
Comments