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.
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
Offset: 1
Keywords
Links
- Eric Weisstein's World of Mathematics, Moore Neighborhood
Programs
-
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,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=9) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023
Comments