

A292672


Least number of symbols required to fill a grid of size n X n row by row in the greedy way such that in any row or column or rectangular 2 X 2 block no symbol occurs twice.


10



1, 4, 6, 6, 7, 8, 10, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, 25, 28, 30, 31, 32, 33, 35, 35, 37, 38, 39, 40, 41, 43, 44, 45, 47, 50, 52, 53, 55, 57, 58, 60, 60, 61, 63, 64, 65, 67, 68, 70, 71, 72, 73, 74, 76, 78, 78, 79, 80, 82, 84, 85, 87, 89, 90, 92, 93, 94
(list;
graph;
refs;
listen;
history;
text;
internal format)



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 2 X 2 rectangles have "floating" borders, so the constraint is actually equivalent to saying that any element must be different from all neighbors in a Moore neighborhood of range 1 (having up to 3*3=9 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 = 4, the 4 X 4 grid is filled as follows:
[1 2 3 4]
[3 4 1 2]
[2 5 6 3]
[4 1 2 5], whence a(4) = 6.
For n = 3 the result would be the upper 3 X 3 part of the above grid, showing that also a(3) = 6.


PROG

(PARI) a(n, m=2, 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, im+1)..i, max(1, jm+1)..min(#g, j+m1)])), 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.


CROSSREFS

Cf. A292670, A292671, A292673, ..., A292679.
Sequence in context: A201235 A205847 A227967 * A018937 A103413 A103412
Adjacent sequences: A292669 A292670 A292671 * A292673 A292674 A292675


KEYWORD

nonn


AUTHOR

M. F. Hasler, Sep 20 2017


EXTENSIONS

Terms a(60) and beyond from Andrew Howroyd, Feb 22 2020


STATUS

approved



