5 persons in a circle, each gets one of 3 colours
adjacent persons must have different coloured hats
To find: number of valid hat distributions
1. view the seats as a 5-cycle
2. fix A’s colour and count along the path
3. multiply by the 3 choices for A
Fix the colour of A:3 ways; count for one, then×3
un=number of proper colourings with the n-th person same as A
vn=number with the n-th person different from A
u1=1,v1=0
un+1=vn,vn+1=2un+vn
(u2,v2)=(0,2),(u3,v3)=(2,2)
(u4,v4)=(2,6),(u5,v5)=(6,10)
Cycle closes with E=A ⇒ v5=10
Total=3×v5=3×10=30
(k−1)n+(−1)n(k−1)=25−2=30
30