Solution:
Notice that a knight on the center square cannot attack any other square on the chessboard, so whether it contains a knight or not is irrelevant.
For ease of reference, we label the other eight squares as follows:
Notice that a knight in square
i attacks both square
i+1 and
i−1 (where square numbers are reduced modulo 8). We now consider the number of ways such that no two knights attack each other.
- 0 knights: 1 way.
- 1 knights: 8 ways.
- 2 knights: (28)−8=20 ways.
- 3 knights: 8+8=16 ways, where the two 8s represent the number of ways such that the "distances" between the knights (index-wise) are 2,2,4 and 2,3,3 respectively.
- 4 knights: 2 ways.
Therefore, out of 28=256 ways, 1+8+20+16+2=47 of them doesn't have a pair of attacking knights. Thus the answer is 256256−47=256209.