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.

Previous Showing 81-89 of 89 results.

A185056 Number of ways to place n nonattacking composite pieces bishop + semi-rook on an n X n board.

Original entry on oeis.org

1, 2, 5, 24, 125, 796, 5635, 48042, 453947, 4834872, 56433455, 727449366, 10099103269, 152097526360, 2449915208271, 42295879864692
Offset: 1

Views

Author

Vaclav Kotesovec, Dec 22 2011

Keywords

Comments

Two semi-rooks do not attack each other if they are in the same column.

Crossrefs

A189863 Number of ways to place n nonattacking composite pieces rook + rider[5,6] on an n X n chessboard.

Original entry on oeis.org

1, 2, 6, 24, 120, 720, 4176, 26140, 185084, 1491098, 13285034, 132514356, 1321161252, 14181339764, 164574628260, 2057033314380
Offset: 1

Views

Author

Vaclav Kotesovec, Apr 29 2011

Keywords

Comments

a(n) is also number of permutations p of 1,2,...,n satisfying |p(i+5k)-p(i)|<>6k AND |p(j+6k)-p(j)|<>5k for all i>=1, j>=1, k>=1, i+5k<=n, j+6k<=n

Crossrefs

A260043 Irregular triangle read by rows: T(n,k) (n >= 1, 0 <= k <= n^2) = number of n X n (0,1) real matrices with k zeros and permanent zero.

Original entry on oeis.org

0, 1, 0, 0, 4, 4, 1, 0, 0, 0, 6, 45, 90, 78, 36, 9, 1, 0, 0, 0, 0, 8, 96, 576, 2128, 4860, 676, 6496, 4080, 1796, 560, 120, 16, 1, 0, 0, 0, 0, 0, 10, 200, 1900, 11500, 50025, 166720, 439600, 923700, 1534800, 1994200, 2010920, 1571525, 956775, 458500, 174700, 53010, 12650, 2300, 300, 25, 1
Offset: 1

Views

Author

N. J. A. Sloane, Jul 22 2015

Keywords

Examples

			Triangle begins:
0,1,
0,0,4,4,1,
0,0,0,6,45,90,78,36,9,1,
0,0,0,0,8,96,576,2128,4860,676,6496,4080,1796,560,120,16,1,
0,0,0,0,0,10,200,1900,11500,50025,166720,439600,923700,1534800,1994200,2010920,1571525,956775,458500,174700,53010,12650,2300,300,25,1,
...
		

References

  • M. B. Wells, Elements of Combinatorial Computing. Pergamon, Oxford, 1971, see p. 240.

A306235 Indices in A306428 of permutations t with a finite number of nonfixed points and such that t_i - t_j <> j - i for any distinct i and j (see Comments for precise definition).

Original entry on oeis.org

0, 2, 4, 7, 8, 14, 15, 24, 28, 32, 33, 39, 48, 56, 60, 63, 64, 72, 80, 87, 96, 104, 111, 121, 122, 127, 134, 135, 138, 140, 142, 147, 150, 156, 159, 160, 168, 176, 184, 185, 192, 202, 207, 242, 246, 247, 258, 277, 296, 312, 314, 316, 318, 322, 326, 327, 333, 366, 367, 385, 414, 415, 416, 420, 423, 426, 428, 432, 438, 443, 447, 504, 505, 506, 536, 537, 540, 567, 569, 602, 604, 628, 660
Offset: 1

Views

Author

Keywords

Comments

Let T be the set of permutations of nonnegative integers t such that t_i = i for all but a finite number of terms i.
The A306428 sequence enumerates the elements of T, hence we have a bijection f from T to the nonnegative integers.
The bijection f has the following properties: for any N > 0:
- if f(t) < N!, then t_i = i for any i >= N,
- this is consistent with the fact that there are N! permutations of (0..N-1),
- if f(t) + f(u) = N!-1, then t_i = u_{N-1-i} for i = 0..N-1,
- in other words, t and u, restricted to (0..N-1), are symmetrical permutations.
This sequence corresponds to the values f(t) of the permutations t in T such that t_i - t_j <> j - i for any distinct i and j.
Hence, for any n > 0 and N > 0:
- if a(n) < N!, then a(n) represents a permutation t of (0..N-1) such that the numbers t_i + i are distinct for i = 0..N-1; this corresponds to a configuration of N queens on an N X N board in which two queens do not attack each other if they are on the same northwest-southeast diagonal,
- this explains the expression of A099152 in the Formula section,
- also if a(n) = N! - 1 - a(m) for some m > 0, then a(n) represents a permutation t of (0..N-1) such that the numbers t_i + i are distinct for i = 0..N-1 and the numbers t_j - j are distinct for j = 0..N-1; this corresponds to a configuration of N nonattacking queens on an N X N board,
- this explains the expression of A000170 in the Formula section.

Examples

			For N = 6, there are 83 matrices in which the sums of the entries of each northeast-southwest diagonal are 0 or 1.
Also, for N = 6, there are 4 ways to place 6 nonattacking queens on a 6 X 6 board.
Finally, the solutions for N = 6 are 150, 296, 423 and 569 (positions within the ordered permutations, see A306428).
150 = (2,4,6,1,3,5);
O O O X O O
X O O O O O
O O O O X O
O X O O O O
O O O O O X
O O X O O O
296 = (3,6,2,5,1,4);
O O O O X O
O O X O O O
X O O O O O
O O O O O X
O O O X O O
O X O O O O
423 = (4,1,5,2,6,3);
O X O O O O
O O O X O O
O O O O O X
X O O O O O
O O X O O O
O O O O X O
569 = (5,3,1,6,4,2);
O O X O O O
O O O O O X
O X O O O O
O O O O X O
X O O O O O
O O O X O O
		

Crossrefs

Formula

A099152(k) = Sum_{i > 0} [k! - 1 - a(i) >= 0] (with [] = Iverson bracket).
A000170(k) = Sum_{i > 0} [k! - 1 - a(i) belongs to {a(n)}].

A306954 Triangle read by rows: T(n, k), for 1 <= k <= n, is the maximum integer q such that k non-attacking armies of q queens can be placed on an n X n chessboard.

Original entry on oeis.org

1, 4, 0, 9, 1, 0, 16, 2, 1, 1, 25, 4, 1, 1, 1, 36, 5, 2, 1, 1, 1, 49, 7
Offset: 1

Views

Author

Benoit Jubin, Mar 17 2019

Keywords

Comments

One has T(n, k) = 0 exactly when (n, k) = (2, 2) or (3, 3).
One has T(n, n) = 1 except when n = 2 or 3 (that is, when A000170(n) = 0).
For a fixed k, the sequence T(-, k) is nondecreasing.
For a fixed n, the sequence T(n, -) is nonincreasing.
For a fixed nonzero p, the sequence (T(k + p, k))_k is nonincreasing. Indeed, given a configuration with k+1 armies on a k+p+1 chessboard, remove the row and column containing a given queen; this row and column can contain only queens of one army, so this yields a configuration of k armies on a k+p chessboard.
One has T(n, 1) = n^2 and T(n, 2) = A250000(n).
For a fixed k, one has, asymptotically in n, that 1/2.(n/k)^2 <= T(n, k) <= (n/k)^2, which can be proved as follows.
For the upper bound, let R(n, k) be defined as T(n, k) with rooks instead of queens. Then, T(n, k) <= R(n, k) ~ (n/k)^2. Indeed, for 1 <= i <= k, say the i^th army controls a_i rows and b_i columns. The sum of the a_i's, as well as the sum of the b_i's, is at most n. The size of the i^th army is at most a_i b_i. Therefore, one wants to maximize min(a_i b_i, i = 1..k). Ignoring rounding, the maximum is reached when all the a_i's and b_i's are equal.
For the lower bound, consider the n X n chessboard as a k X k grid with cells of size (n/k) X (n/k). Consider a configuration of k non-attacking queens on the k X k chessboard as in A000170(k). Place each of the k armies inside one cell occupied in that configuration. The precise placement is as follows: the army occupies the square whose vertices are the midpoints of the sides of the cell, hence has size 1/2.(n/k)^2. These armies are non-attacking.

Examples

			Triangle begins:
   1
   4  0
   9  1  0
  16  2  1  1
  25  4  1  1  1
  36  5  2  1  1  1
  49  7  .  .  1  1  1
  64  9  .  .  .  1  1  1
  81 12  .  .  .  .  1  1  1
		

Crossrefs

Column 1 gives A000290, n >= 1.
Cf. A000170 (non-attacking queens).
Column 2 gives A250000 (case of two armies).

A354673 Smallest number of unit cells that must be removed from an n X n square board in order to avoid any cycles.

Original entry on oeis.org

0, 1, 2, 4, 6, 10, 13, 18, 22, 28, 34, 42, 49, 58, 66, 76, 86, 98, 109, 122, 134, 148, 162, 178, 193, 210, 226, 244, 262, 282, 301, 322, 342, 364, 386, 410, 433, 458, 482, 508, 534, 562, 589, 618, 646, 676, 706, 738, 769, 802, 834, 868, 902, 938, 973, 1010, 1046
Offset: 1

Views

Author

Giedrius Alkauskas, Jun 02 2022

Keywords

Comments

A "cycle" means a rook-connected closed path of squares.
The proof of this result is given in the Links section.
a(n+1) is very close to A239231(n); more precisely, the difference is the sequence 1,0,1,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,2,1,2,3,2.

Examples

			For n = 2, a(2) = 1, since removing any unit square from the 2 X 2 board leaves no cycles.
For n = 5, a(5) = 6 removed unit squares can be arranged as follows:
  x****
  *x*x*
  **x**
  *x*x*
  *****
		

Crossrefs

Formula

a(n) = ceiling(n^2/3 - n/6 + 4/3) - ceiling(n/2) for n >= 3.
From Stefano Spezia, Jun 02 2022: (Start)
G.f.: x^2*(1 + x^2 + 2*x^4 - x^5 + x^6 - x^7 + x^8)/((1 - x)^3*(1 + x)*(1 - x + x^2)*(1 + x + x^2)).
a(n) = 2*a(n-1) - a(n-2) + a(n-6) - 2*a(n-7) + a(n-8) for n > 2. (End)

A365437 Number of ways of placing n non-attacking queens on an n X n board, with no three queens in a straight line.

Original entry on oeis.org

1, 1, 0, 0, 2, 0, 0, 0, 8, 32, 40, 96, 410, 1392, 4416, 18752, 71486, 235056, 1001972, 4285920, 21887710, 94619480, 422557444, 2101021824, 11943690634, 61113195600
Offset: 0

Views

Author

Don Knuth, Nov 07 2023

Keywords

Examples

			For n=8, place queens for rows 1..8 into columns 3,6,8,2,4,1,7,5, i.e.,
.
  +-----------------+
  | . . Q . . . . . |
  | . . . . . Q . . |
  | . . . . . . . Q |
  | . Q . . . . . . |
  | . . . Q . . . . |
  | Q . . . . . . . |
  | . . . . . . Q . |
  | . . . . Q . . . |
  +-----------------+
.
and rotate and/or reflect to get the other seven ways.
.
(Note that solutions such as
.
  +-----------------+
  | . . Q . . . . . |
  | . . . . . Q . . |
  | . . . Q . . . . |
  | Q . . . . . . . |
  | . . . . . . . Q |
  | . . . . Q . . . |
  | . . . . . . Q . |
  | . Q . . . . . . |
  +-----------------+
.
do not count as the queens on rows 4, 6, and 7 are in a straight line.)
		

References

  • Donald E. Knuth, Constraint Satisfaction (volume 4, fascicle 7a of The Art of Computer Programming, in preparation).

Crossrefs

Extensions

a(21) from Martin Ehrenstein, Nov 08 2023
a(22) from Martin Ehrenstein, Nov 09 2023
a(23) from Martin Ehrenstein, Nov 10 2023
a(24) from Martin Ehrenstein, Nov 16 2023
a(25) from Martin Ehrenstein, May 02 2024

A374013 n-queens completion threshold. The maximum number such that placing a(n) or fewer mutually non-attacking queens on an n X n chessboard is always completeable to a full n-queen configuration.

Original entry on oeis.org

0, 1, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4
Offset: 4

Views

Author

Hugo M. Nielsen, Jun 25 2024

Keywords

Comments

For n large enough, n/60 <= a(n) <= 0.241*n [Glock et al.].

Examples

			There are 2 solutions to the 4-queens problem:
  . Q . .
  . . . Q
  Q . . .
  . . Q .
and
  . . Q .
  Q . . .
  . . . Q
  . Q . .
Neither of these has a queen in the upper left corner, so placing a queen here will definitely make the configuration non-completable, while placing no queens is completable, see the two examples.
		

Crossrefs

Cf. A000170.

Programs

  • C
    \\ see github link

A378488 Table T(n,k) read by rows where in the n-th row the k-th column is the permutation rank of the k-th solution to the n-queens problem in a n X n board.

Original entry on oeis.org

0, 0, 0, 10, 13, 10, 13, 36, 44, 50, 69, 75, 83, 106, 109, 186, 346, 373, 533, 186, 346, 373, 533, 980, 1032, 1090, 1108, 1188, 1244, 1399, 1515, 1519, 1905, 1956, 2074, 2090, 2197, 2210, 2390, 2649, 2829, 2842, 2949, 2965, 3083, 3134, 3520, 3524, 3640, 3795, 3851
Offset: 1

Views

Author

Darío Clavijo, Nov 28 2024

Keywords

Comments

The length of the n-th row is A000170(n) for n >= 4.

Examples

			Table T(n,k) reads as follows:
 n / k
-------------------------------------------
 1 | 0
 2 | 0
 3 | 0
 4 | 10, 13
 5 | 10, 13, 36, 44, 50, 69, 75, 83, 106, 109
 6 | 186, 346, 373, 533
For a table of 4 by 4 one of the solutions for placing the 4 queens is [(0,1),(1,3),(2,0),(3,2)] and its compact representation is [1, 3, 0, 2],
this resulting representation is a permutation that can be ranked and its rank is 10.
T(1) = [0]
  *-*
  |Q| Permutation: [0], Rank: 0
  *-*
T(2) = [0] because of no solution and n < 4.
T(4) = [10, 13]
     0 1 2 3         0 1 2 3
   +---------+     +---------+
 0 | . Q . . |     | . . Q . |
 1 | . . . Q |     | Q . . . |
 2 | Q . . . |     | . . . Q |
 3 | . . Q . |     | . Q . . |
   +---------+     +---------+
   Permutation:    Permutation:
    [1, 3, 0, 2]    [2, 0, 3, 1]
   Rank: 10        Rank: 13
T(6) = [186, 346, 373, 533]:
     0 1 2 3 4 5          0 1 2 3 4 5          0 1 2 3 4 5          0 1 2 3 4 5
   +-------------+      +-------------+      +-------------+      +-------------
 0 | . Q . . . . |      | . . Q . . . |      | . . . Q . . |      | . . . . Q . |
 1 | . . . Q . . |      | . . . . . Q |      | Q . . . . . |      | . . Q . . . |
 2 | . . . . . Q |      | . Q . . . . |      | . . . . Q . |      | Q . . . . . |
 3 | Q . . . . . |      | . . . . Q . |      | . Q . . . . |      | . . . . . Q |
 4 | . . Q . . . |      | Q . . . . . |      | . . . . . Q |      | . . . Q . . |
 5 | . . . . Q . |      | . . . Q . . |      | . . Q . . . |      | . Q . . . . |
   +-------------+      +-------------+      +-------------+      +-------------+
   Permutation:         Permutation:         Permutation:         Permutation:
    [1, 3, 5, 0, 2, 4]   [2, 5, 1, 4, 0, 3]   [3, 0, 4, 1, 5, 2]   [4, 2, 0, 5, 3, 1]
   Rank:186             Rank:346             Rank: 373            Rank: 533
		

Crossrefs

Cf. A000170.

Programs

  • Python
    from sympy.combinatorics import Permutation
    def queens(n, i = 0, cols=0, pos_diags=0, neg_diags=0, sol=None):
        if sol is None: sol = []
        if i == n: yield sol[:]
        else:
            neg_diag_mask_ = 1 << (i+n)
            col_mask = 1
            for j in range(n):
                col_mask <<= 1
                pos_diag_mask = col_mask << i
                neg_diag_mask = neg_diag_mask_ >> (j+1)
                if not (cols & col_mask or pos_diags & pos_diag_mask or neg_diags &
    neg_diag_mask):
                    sol.append(j)
                    yield from queens(n, i + 1,
                                      cols | col_mask,
                                      pos_diags | pos_diag_mask,
                                      neg_diags | neg_diag_mask,
                                      sol)
                    sol.pop()
    row = lambda n: [Permutation(sol).rank() for sol in queens(n)]  if n >= 4 else [0]

Formula

a(n) = 0 if no solution exists or n = 1.
Previous Showing 81-89 of 89 results.