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-8 of 8 results.

A292671 Upper right triangle A(m,n) = 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 m X m square a symbol occurs more than once.

Original entry on oeis.org

1, 2, 4, 4, 6, 9, 4, 6, 11, 16, 8, 7, 13, 18, 25, 8, 8, 13, 18, 27, 36, 8, 10, 13, 20, 29, 38, 49, 8, 10, 13, 20, 32, 38, 51, 64, 16, 13, 14, 22, 33, 40, 53, 66, 81, 16, 15, 14, 22, 33, 40, 56, 66, 83, 100, 16, 16, 15, 23, 33, 41, 57, 68, 85, 102
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 m X m 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 m-1 (having up to (2m-1)^2 grid points). See A292673 for examples.
One can consider the infinite square array A(m,n) defined in the same way, but the lower triangular part of it is uninteresting: for m>n one has A(m,n) = n^2, i.e., the columns continue below the diagonal indefinitely with the same value, n^2.

Examples

			The infinite square array would look as follows: (but the sequence only lists the upper right triangle: 1; 2, 4; 4, 6, 9; 4, 6, 11, 16; ...):
   [1  2  4  4  8  8  8  8 16 ...]  m=1: A(1,n) = 2^ceil(log_2(n)) = A062383(n-1)
   [1\_4  6  6  7  8 10 10 13 ...]  m=2: A(2,n) = A292672(n)
   [1  4\_9 11 13 13 13 13 14 ...]  m=3: A(3,n) = A292673(n) : see here
   [1  4  9\16 18 18 20 20 22 ...]  m=4: A(4,n) = A292674(n) :  for examples
   [1  4  9 16\25 27 29 32 33 ...]  m=5: A(5,n) = A292675(n)
   [1  4  9 16 25\36 38 38 40 ...]  m=6: A(6,n) = A292676(n)
   [1  4  9 16 25 36\49 51 53 ...]  m=7: A(7,n) = A292677(n)
   [1  4  9 16 25 36 49\64 66 ...]  m=8: A(8,n) = A292678(n)
   [1  4  9 16 25 36 49 64\81 ...]  m=9: A(9,n) = A292679(n)
   [...   ...  ...  ...  ...  ...]
		

Crossrefs

Programs

  • PARI
    A(m, n, 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(m, n): # change m for A292672, ..., A292679
        mx, S, N, b = 0, {1}, range(1, n+1), m # b is block size
        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 > mx:
                    mx = e
                    S.add(mx+1)
                row[i].add(e)
                col[j].add(e)
        return mx
    print([A(m, n) for n in range(1, 12) for m in range(1, n+1)]) # Michael S. Branicky, Apr 13 2023

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

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-8 of 8 results.