[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Revisions by Darío Clavijo (See also Darío Clavijo's wiki page)

(Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
allocated for Darío Clavijo
(history; published version)
#5 by Darío Clavijo at Thu Nov 28 16:40:40 EST 2024
STATUS

editing

proposed

Discussion
Thu Nov 28
16:40
Darío Clavijo: Fixed
16:41
Darío Clavijo: Thanks!
#4 by Darío Clavijo at Thu Nov 28 16:40:36 EST 2024
PROG

row = lambda n: [Permutation(sol).rank() for sol in queens(n)] if n >= 4 else [[1, 0, 0][n-1]]

STATUS

proposed

editing

#3 by Darío Clavijo at Thu Nov 28 11:06:27 EST 2024
STATUS

editing

proposed

Discussion
Thu Nov 28
16:29
Peter Luschny: row(1) is ? Prog. gives 1.
#2 by Darío Clavijo at Thu Nov 28 11:05:54 EST 2024
NAME

allocated for Darío Clavijo

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.

DATA

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,4

COMMENTS

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

LINKS

Wikipedia, <a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle">Eight queens puzzle</a>

FORMULA

a(n) = 0 if no solution exists or n = 1.

EXAMPLE

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

PROG

(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 [[1, 0, 0][n-1]]

CROSSREFS

Cf. A000170.

KEYWORD

allocated

nonn,tabf

AUTHOR

Darío Clavijo, Nov 28 2024

STATUS

approved

editing

#1 by Darío Clavijo at Thu Nov 28 11:05:54 EST 2024
NAME

allocated for Darío Clavijo

KEYWORD

allocated

STATUS

approved

Von Neumann ordinals in bracket notation encoded by binary bits: '{' -> 0, '}'-> 1.
(history; published version)
#110 by Darío Clavijo at Tue Nov 26 11:38:26 EST 2024
STATUS

editing

proposed

Number of solutions that satisfy the congruence: i^2 == j^2 (mod n) with 1 <= i < j <= n.
(history; published version)
#48 by Darío Clavijo at Tue Nov 26 11:08:47 EST 2024
STATUS

editing

proposed

#47 by Darío Clavijo at Tue Nov 26 11:08:43 EST 2024
COMMENTS

a(n) >= A060594(n) for n >= 4.

CROSSREFS
STATUS

proposed

editing

allocated for Darío Clavijo
(history; published version)
#30 by Darío Clavijo at Tue Nov 26 10:46:08 EST 2024
STATUS

editing

proposed

Discussion
Tue Nov 26
10:47
Darío Clavijo: NAME ended too long, I don't know if  the best thing here is to swap NAME for the first COMMENT?...
10:48
Darío Clavijo: now sample does not contain a palindrome in any way...
11:10
Darío Clavijo: s/sample/EXAMPLE/
#29 by Darío Clavijo at Tue Nov 26 10:46:00 EST 2024
NAME

a(n) is the cumulative bit XOR of the bits in the binary representation of n.

In the binary representation of n read from the most to least significant bit order then perform a cumulative XOR and store from least to most significant bit order.