

A292679


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 9 X 9 block no symbol occurs twice.


9



1, 4, 9, 16, 25, 36, 49, 64, 81, 83, 85, 88, 89, 91, 92, 94, 95, 95, 96, 97, 100, 102, 103, 104, 103, 105, 102, 103, 104, 104, 104, 104, 105, 107, 108, 108, 115, 114, 115, 111, 112, 112, 111, 113, 117, 118, 119, 120, 121, 122, 123, 124, 126, 126, 126, 126, 126, 126
(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 9 X 9 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 8 (having up to 17*17 = 289 grid points).
See sequences A292672, A292673, A292674 for examples.


LINKS

Table of n, a(n) for n=1..58.
Eric Weisstein's World of Mathematics, Moore Neighborhood


PROG

(PARI) a(n, m=9, 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, A292672, ..., A292678.
Sequence in context: A048387 A035121 A080151 * A106545 A169920 A093837
Adjacent sequences: A292676 A292677 A292678 * A292680 A292681 A292682


KEYWORD

nonn


AUTHOR

M. F. Hasler, Sep 20 2017


STATUS

approved



