ColorSplit: Counting n-Queens Solutions by Splitting the Board into Colors
We present ColorSplit, an exact algorithm for counting the solutions Q(n) of the n-queens problem, and use it to compute the previously unknown value Q(28) = 2,564,269,152,506,723,832 in 436 hours on a single GPU. Queens on white squares never attack queens on black squares along a diagonal, so every solution splits into a white part and a black part that interact only through rows and columns. For each set of rows given to the white queens, the white placements are tabulated by their column set, and each black placement on the remaining rows is matched by a single table lookup at the complementary column set. A parity law on rows, the board symmetries, a weighted transposition symmetry, early pruning and a compact table complete the method. In our measurements the cost grows roughly as the square root of Q(n) times 2^n, against about Q(n) for backtracking; on one CPU core Q(21) takes 21 minutes, about 4 ns per solution, and on one GPU we recomputed Q(27) in 62 hours. Q(28) passes every check we made: the 4096 published partial sums add up exactly, the total is divisible by 4, and a random sample of 50 chunks recomputed along two different code paths agrees exactly. This research was done with the help of Claude, an AI model by Anthropic. Code and all partial sums: https://github.com/SergeyChere/colorsplit-nqueens
Authors
- Sergii Cherepanov
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-03
- DOI
- https://doi.org/10.5281/zenodo.23901119
- Primary Topic
- Constraint Satisfaction and Optimization
- Type
- preprint