Abstract:So far, there have been many different algorithm of eight queens problem. A similar sieve algorithm is presented in this paper: Using a algorithm similar to the sieve method in number theory: place the first queen in the first grid of the first row, and mark out the row, the column, the downward diagonal and the upward diagonal through the first queen;then place the second queen on the most left grid of the unmarked grid of the second row, and mark out the row, the column, the downward diagonal and the upward diagonal through the second queen;like this, queens are added, one by one. if all the queens can be placed on the board, a layout or a solution received. Traversing all grids of all row, we would get all solutions of N-queens problem. Based on the simple idea, we can develop a N-queens program easily. The experimental results show that the efficiency of the sieve program is much higher than the classic backtracking program.