So I have this question,
Five persons A, B, C, D and E are seated in a circular arrangement. If each of them is given a hat of one of the three colours red, blue and green, then the number of ways of distributing the hats such that the persons seated in adjacent seats get different coloured hats is _________.
What I did was , make cases. A has 3 options (RGB)
Say A gets Red
Case 1
B,E get both blue or green (2 options) leaving 2 options for C,D
Case 2
B gets Blue and E green or vice versa(2 options ) leaving 3 options for C,D
The answer comes out to be 3*2*(2+3) = 30
Is there any shorter more elegant method than manual counting
Eg:if there were more people , manual counting may become tedious , and prone to error
No color can be used $\geq3$ times; hence one color is used once, and the other colors are used twice. You can choose the single color in three ways and the person to obtain it in five ways. The remaining hats then can be allocated in two ways, makes $3\cdot5\cdot2=30$ in total.