How many to color the fields of a chessboard

combinatorics

From Pavle Mladenović's Combinatorics: A Problem-Based Approach

How many ways are there to color the fields of a chessboard $8 \times 8$ using $8$ colors, such that every color appears in each row, and no two adjacent fields in the same column are of the same color?

Since the derangement formula is !$n = \frac{n!}{e}$.
Will this just be $\frac{8!}{e}$?

Best Answer

You're close, but you're thinking too small.

There are $8!$ ways to colour the first row (and we are already beyond your $!8$ suggestion). Then there are $!8$ ways to colour the second row. And then there are $!8$ ways to colour the third row. And so on.

So the answer is that there are $8!\cdot (!8)^7$ ways to colour the chessboard under these restrictions.