I play chess occasionally but I don’t know what happened and made me remember this problem. The 8-Queens problem goes like this. You have an empty chessboard and you have to place eight queens on it in a way that no two queens can attack each other. This simply means that each row, column or diagonal has only one queen. It is a well known problem and it is used in Artificial Intelligence courses. The eight queens is the real example for the generalized problem, the n-queens on a nxn chessboard. There are solutions when n equals to 1 or be greater than 3. This problem is also known as the eight queens puzzle and it was proposed in 1848 by Max Bezzel.

There are 92 unique solutions to the Eight Queens Problem but only 12 of them are distinct. You can generate four of them (one distinct) by using the following formula. (2^8-1) / (8-1) = 255 / 7 = 36.428571 (rounded to six decimals). This simple calculation gives you the positions to place the queens to a chessboard. The first queen is placed on first row and 3rd column, second one on second row and 6th column and so on. You can impress your friends or students by solving this problem on the fly with the help of a simple calculator.

A simple solution to Eight Queens Problem