If we call the colours red, yellow and blue (R, Y and B) and arrange them in alphabetical order, BRY, we can see there are only 10 combinations: BBB BBR BBY BRR BRY BYY RRR RRY RYY YYY, because by preserving alphabetical order in each combination, we can avoid repeating the same combination in a differen order. There are 3 beginning BB; 2 beginning BR; 1 beginning BY; 2 beginning RR; 1 beginning RY and 1 beginning YY. That's (3+2+1)+(2+1)+(1)=10. See the pattern? With 4 colours it would be (4+3+2+1)+(3+2+1)+... If the order of the 3 blocks mattered, there would be 3*3*3=27 possibilities.