Heres one neat way to express the N-queen problem.
Simple math shows that if two queens can attack each other, one of the following must apply:

- They must be on the same column.
- They must be on the same row.
- The sum of the row and column must be the same for both( \ diagonal).
- The difference of the row and column must be the same for both ( / diagonal).

It can be thought of as a simultaneous equation with 2N unknowns.

Find integers x_{1} ... x_{n} and y_{1} ... y_{n} in the range 1 .. n such that :

Given integers A and B in the range 1..n and A ≠ B

- x
_{A} ≠ x_{B} ( No two queens on same column )
- y
_{A} ≠ y_{B} ( No two queens on same row )

For all combinations of integers A and B in the range 1..n and A ≠ B

- (x
_{A} + y_{A}) ≠ (x_{B} + y_{B}) (No two queens on \ diagonal)
- (x
_{A} - y_{A}) ≠ (x_{B} - y_{B}) (No two queens on / diagonal)