cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A292672 #22 Feb 16 2025 08:33:51
%S A292672 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,
%T A292672 37,38,39,40,41,43,44,45,47,50,52,53,55,57,58,60,60,61,63,64,65,67,68,
%U A292672 70,71,72,73,74,76,78,78,79,80,82,84,85,87,89,90,92,93,94
%N 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.
%C A292672 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.
%C A292672 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).
%H A292672 Michael S. Branicky, <a href="/A292672/b292672.txt">Table of n, a(n) for n = 1..1000</a> (terms 1..100 from Andrew Howroyd)
%H A292672 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/MooreNeighborhood.html">Moore Neighborhood</a>
%e A292672 For n = 4, the 4 X 4 grid is filled as follows:
%e A292672    [1 2 3 4]
%e A292672    [3 4 1 2]
%e A292672    [2 5 6 3]
%e A292672    [4 1 2 5], whence a(4) = 6.
%e A292672 For n = 3 the result would be the upper 3 X 3 part of the above grid, showing that also a(3) = 6.
%o A292672 (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,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.
%o A292672 (Python)
%o A292672 def a(n):
%o A292672     m, s, N = 0, {1}, range(1, n+1)
%o A292672     g = [[0 for j in range(n+2)] for i in range(n+2)]
%o A292672     row, col = {i:set() for i in N}, {j:set() for j in N}
%o A292672     for i in N:
%o A292672         for j in N:
%o A292672             rect = {g[i-1][j-1], g[i-1][j], g[i][j-1], g[i-1][j+1]}
%o A292672             e = min(s - row[i] - col[j] - rect)
%o A292672             g[i][j] = e
%o A292672             row[i].add(e)
%o A292672             col[j].add(e)
%o A292672             if e > m:
%o A292672                 m = e
%o A292672                 s.add(m+1)
%o A292672     return m
%o A292672 print([a(n) for n in range(1, 71)]) # _Michael S. Branicky_, Apr 13 2023
%Y A292672 Cf. A292670, A292671, A292673, ..., A292679.
%K A292672 nonn
%O A292672 1,2
%A A292672 _M. F. Hasler_, Sep 20 2017
%E A292672 Terms a(60) and beyond from _Andrew Howroyd_, Feb 22 2020