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.

Showing 1-9 of 9 results.

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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).

Examples

			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.
		

Crossrefs

Programs

  • 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.
    
  • Python
    def a(n):
        m, s, N = 0, {1}, range(1, n+1)
        g = [[0 for j in range(n+2)] for i in range(n+2)]
        row, col = {i:set() for i in N}, {j:set() for j in N}
        for i in N:
            for j in N:
                rect = {g[i-1][j-1], g[i-1][j], g[i][j-1], g[i-1][j+1]}
                e = min(s - row[i] - col[j] - rect)
                g[i][j] = e
                row[i].add(e)
                col[j].add(e)
                if e > m:
                    m = e
                    s.add(m+1)
        return m
    print([a(n) for n in range(1, 71)]) # Michael S. Branicky, Apr 13 2023

Extensions

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

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

Original entry on oeis.org

1, 6, 14, 26, 40, 53, 73, 114, 144, 161, 188, 210, 250, 279, 329, 482, 544, 577, 611, 656, 697, 752, 847, 906, 947, 973, 1049, 1113, 1210, 1284, 1425, 1986, 2112, 2177, 2242, 2326, 2408, 2473, 2632, 2748, 2818, 2886, 3004, 3125, 3334, 3390, 3539, 3661, 3806, 3870
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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 n X n rectangles have "floating" borders, so the constraint is actually equivalent to say that any element must be different from all neighbors in a Moore neighborhood of range n-1 (having up to (2n-1)^2 grid points).

Examples

			For n = 2, 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(2) = 6.
		

Crossrefs

Cf. A292671: grid size independent of block size; A292672, ..., A292679: A(m,n) for fixed n=2,...,9.

Programs

  • PARI
    a(m,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^2 X n^2 board.
    
  • Python
    def a(n):
        s, b = n*n, n # side length, block size
        m, S, N = 0, {1}, range(1, s+1)
        g = [[0 for j in range(s+b)] for i in range(s+b)]
        row, col = {i:set() for i in N}, {j:set() for j in N}
        offsets = [(i, j) for i in range(-b+1, 1) for j in range(-b+1, 1)]
        offsets += [(i, j) for i in range(-b+1, 0) for j in range(1, b)]
        for i in N:
            for j in N:
                rect = set(g[i+o[0]][j+o[1]] for o in offsets)
                e = min(S - row[i] - col[j] - rect)
                g[i][j] = e
                if e > m:
                    m = e
                    S.add(m+1)
                row[i].add(e)
                col[j].add(e)
        return m
    print([a(n) for n in range(1, 13)]) # Michael S. Branicky, Apr 13 2023

Extensions

a(9) and beyond from Michael S. Branicky, Apr 13 2023

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

Original entry on oeis.org

1, 4, 9, 11, 13, 13, 13, 13, 14, 14, 15, 17, 18, 21, 22, 23, 25, 26, 27, 29, 30, 31, 32, 34, 35, 38, 39, 40, 42, 45, 47, 49, 51, 53, 54, 55, 55, 55, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 74, 76, 78, 79, 83, 83, 85, 86, 88, 90, 91, 92, 93, 96
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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 3 X 3 rectangles have "floating" borders, so the constraint is actually equivalent to say that any element must be different from all neighbors in a Moore neighborhood of range 2 (having up to 5*5 = 25 grid points).

Examples

			For n = 4, the 4 X 4 grid is filled as follows (using hexadecimal digits):
   [1  2  3  4]
   [4  5  6  1]
   [7  8  9  A]
   [2  3  B  7], whence a(4) = # { 1, ..., 9, A, B} = 11.
For n = 8, the grid is filled as follows:
  [1  2  3  4  5  6  7  8]
  [4  5  6  1  2  3  9  A]
  [7  8  9  A  B  C  1  2]
  [2  3  C  7  4  5  6  B]
  [5  1  D  2  3  8  A  4]
  [6  4  8  9  1  D  2  3]
  [3  7  A  5  6  B  C  1]
  [9  B  2  3  7  4  5  6], whence a(8) = # { 1, ..., 9, A, B, C, D } = 13.
For n = 5, 6 and 7, the solution is just the upper left n X n part of the above grid: all of these also require 13 symbols.
		

Crossrefs

Programs

  • PARI
    a(n,m=3,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
    def A292673(n, b=3): # change b for A292672, ..., A292679
        m, S, N = 0, {1}, range(1, n+1)
        g = [[0 for j in range(n+b)] for i in range(n+b)]
        row, col = {i:set() for i in N}, {j:set() for j in N}
        offsets = [(i, j) for i in range(-b+1, 1) for j in range(-b+1, 1)]
        offsets += [(i, j) for i in range(-b+1, 0) for j in range(1, b)]
        for i in N:
            for j in N:
                rect = set(g[i+o[0]][j+o[1]] for o in offsets)
                e = min(S - row[i] - col[j] - rect)
                g[i][j] = e
                if e > m:
                    m = e
                    S.add(m+1)
                row[i].add(e)
                col[j].add(e)
        return m
    print([A292673(n) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023

Extensions

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

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.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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.

Crossrefs

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

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

Original entry on oeis.org

1, 4, 9, 16, 18, 18, 20, 20, 22, 22, 23, 23, 23, 24, 25, 26, 26, 26, 29, 32, 32, 34, 36, 38, 38, 38, 42, 42, 42, 44, 44, 45, 48, 49, 49, 49, 54, 54, 54, 56, 59, 59, 64, 65, 68, 69, 70, 73, 76, 78, 79, 79, 82, 82, 83, 86, 87, 89, 90, 92, 95, 95, 96, 96, 97, 97
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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).

Examples

			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.
		

Crossrefs

Programs

  • 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

Extensions

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

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

Original entry on oeis.org

1, 4, 9, 16, 25, 27, 29, 32, 33, 33, 33, 34, 35, 35, 35, 36, 37, 38, 40, 40, 40, 40, 40, 40, 40, 40, 41, 43, 42, 42, 46, 47, 48, 52, 53, 53, 54, 57, 58, 58, 59, 62, 63, 64, 66, 68, 70, 72, 73, 74, 75, 75, 78, 78, 79, 80, 82, 83, 85, 86, 88, 91, 92, 97, 96, 98
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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 5 X 5 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 4 (having up to 9*9 = 81 grid points).

Crossrefs

Programs

  • PARI
    a(n,m=5,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=5) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023

Extensions

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

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

Original entry on oeis.org

1, 4, 9, 16, 25, 36, 49, 64, 66, 66, 68, 68, 69, 69, 70, 70, 73, 76, 81, 84, 83, 82, 84, 79, 81, 83, 85, 85, 85, 85, 86, 88, 88, 92, 91, 88, 89, 92, 89, 93, 92, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 114, 114, 114, 114, 114
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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 8 X 8 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 7 (having up to 15*15 = 225 grid points).
See sequences A292672, A292673, A292674 for examples.

Crossrefs

Programs

  • PARI
    a(n,m=8,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=8) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023

Extensions

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

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

Original entry on oeis.org

1, 4, 9, 16, 25, 36, 38, 38, 40, 40, 41, 41, 43, 45, 48, 48, 50, 49, 49, 49, 49, 50, 50, 51, 51, 52, 51, 52, 53, 53, 53, 53, 53, 53, 55, 53, 55, 55, 59, 59, 59, 61, 65, 64, 66, 70, 68, 69, 72, 73, 78, 78, 79, 84, 85, 85, 86, 90, 90, 90, 94, 93, 96, 97, 99, 102, 105, 106, 106, 107
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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 6 X 6 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 5 (having up to 11*11 = 121 grid points).

Crossrefs

Programs

  • PARI
    a(n,m=6,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=6) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023

Extensions

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

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

Original entry on oeis.org

1, 4, 9, 16, 25, 36, 49, 51, 53, 56, 57, 59, 60, 60, 61, 62, 64, 66, 65, 64, 62, 62, 64, 66, 65, 67, 67, 67, 66, 67, 69, 67, 69, 69, 70, 70, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 75, 76, 78, 80, 80, 83, 82, 83, 87, 94, 99, 106, 107, 108, 109, 110, 111, 112, 112
Offset: 1

Views

Author

M. F. Hasler, Sep 20 2017

Keywords

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 7 X 7 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 6 (having up to 13*13 = 169 grid points).

Crossrefs

Programs

  • PARI
    a(n,m=7,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=7) for n in range(1, 101)]) # Michael S. Branicky, Apr 13 2023

Extensions

Terms a(60) and beyond from Andrew Howroyd, Feb 22 2020
Showing 1-9 of 9 results.