How many ways can you arrange the nine letters A, B, C, D, E, F, G, H, I in a row, if B cannot immediately follow A?
The 9 letters can be arranged in: 9! =362,880 ways.
Each of the 9 letters can follow another letter in: 1/9 x 9! =40,320 ways.
Conversely, each letter will be separated from the other 8 letters in:8/9 x 9! = 322,560 ways - or this is the number of ways where B cannot immediately follow A.