Lets Solve this by patterns possible and there are
k!/(k−n)! ways to put k things into n ordered slots.
here k =3 and n ordered slots can understood as:
RRRRR here all beads of red color so it is 1 ordered slot
RRBBR here there are 2 things used so it is 2 ordered slot.
Now Let R =x, G=y, B=z
possible combinations
xxxxx: 3 = 3!/(3−1)!
xxxxy: 6 = 3!/(3−2)!
xxxyy: 6 = 3!/(3−2)!
xxxyz: 6 = 3!/(3−3)
xxyyz: 6 = 3!/(3−3)!
xxyxy: 6 = 3!/(3−2)!
xxyxz: 6 = 3!/(3−3)!
xxyzy: 6 = 3!/(3−3)!
xyzyz: 6 = 3!/(3−2)!
3 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 = 51