# Why is the size of the search space 2057 in the 8-queen puzzle?

In the 8-queen puzzle, to reduce the search space, we can use an incremental approach. We put the first queen in the first column, then the 2nd queen in the 2nd column etc., avoiding the slots that are already being occupied.

According to Peter Norvig's book, there are only 2057 possible sequences. Where does that number come from?

• It probably comes from an exhaustive search. – Yuval Filmus May 23 '13 at 16:23
• ...which requires only $O(1)$ time. – JeffE May 23 '13 at 21:20
• @JeffE If that was sufficient for practical efficiency, the world would be a better place. – Raphael May 28 '13 at 17:52
• Perhaps I should have written "Which requires about 15 seconds of computation on your cell phone." – JeffE May 28 '13 at 20:22

For the $n$-queens problem, it is not too hard to show that $(n!)^{(1/3)}$ is a lower bound on the size of state space. This can be calculated by considering the maximum number of squares in each column that might be threatened by queens from previous columns. For $n=8$, this evaluates to $34.29$.