25 books - permutation question

104 Views Asked by At

Imagine 25 books, 5 groups of books (e.g. maths, biology, history, geography, philosophy...) and all groups has 5 seperate colors of books (black, blue, yellow, red, green). So there are 5 blue books including one from each group.

So the question is, how many possible ways to sort these books, so there are no same group of books next to each other and there are no same color of books next to each other?

I hope I could explain. Thanks in advance, Koray