OFFSET
1,2
COMMENTS
Consider the symbols as positive integers. By the greedy way we mean to fill the grid row by row from left to right always with the least possible positive integer such that the three constraints (on rows, columns and rectangular blocks) are satisfied.
In contrast to the sudoku case, the 4 X 4 rectangles have "floating" borders, so the constraint is actually equivalent to say that an element must be different from all neighbors in a Moore neighborhood of range 3 (having up to 7*7 = 49 grid points).
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..100
Eric Weisstein's World of Mathematics, Moore Neighborhood
EXAMPLE
For n = 8, the grid is filled as follows:
[ 1 2 3 4 5 6 7 8]
[ 5 6 7 8 1 2 3 4]
[ 9 10 11 12 13 14 15 16]
[13 14 15 16 9 10 11 12]
[ 2 3 4 17 18 5 6 7]
[ 6 1 8 7 2 3 4 17]
[10 5 12 19 20 1 8 13]
[11 9 13 14 10 15 12 19]
whence a(8) = 20.
PROG
(PARI) a(n, m=4, g=matrix(n, n))={my(ok(g, k, i, j, m)=if(m, ok(g[i, ], k)&&ok(g[, j], k)&&ok(concat(Vec(g[max(1, i-m+1)..i, max(1, j-m+1)..min(#g, j+m-1)])), k), !setsearch(Set(g), k))); for(i=1, n, for(j=1, n, for(k=1, n^2, ok(g, k, i, j, m)&&(g[i, j]=k)&&break))); vecmax(g)} \\ without "vecmax" the program returns the full n X n board.
(Python) # uses function in A292673
print([A292673(n, b=4) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Sep 20 2017
EXTENSIONS
Terms a(40) and beyond from Andrew Howroyd, Feb 22 2020
STATUS
approved