How many ten-digit numbers are there in which every digit is 2 or 3, and no two 3s are adjacent?
Taken from the 2008 IMC https://chiuchang.org/wp-content/uploads/sites/2/2018/02/2008-IWYMIC-Individual.x17381.pdf
my attempt
The number of ten digit numbers in which the digits are either 2 or 3 is $2^{10}$ and the numbers of ten digit numbers where there is no pair of adjacent numbers that are the same is $2$ E.g($2323232323$ & $3232323232$) and we know that the number of ten digit numbers consisting of pairs of adjacent $2$s and adjacent $3$s is the same due to symmetry therefore the answer would be $\frac{2^{10}-2}{2}=511$ however this doesn't taken into account the possibilities of having adjacent pairs of $3$s and $2$s in the same number.
Suppose you have r number of 3 in a line. Now we know 3 can't be adjacent so I have to put at least 1 in between them. For example-r=3 |-|-|(| denotes 3 and - denotes 2). Now we have x=10-(r+r-1) 2's remaining. Now we can put these 2's in r+1 slots(in the example we can put in 4 slots slot1|slot2|slot3|slot4). Now this becomes a standard problem Stars and bars of x1+x2+x3+..xl=p (where l denotes the number of slots and where every xi can be 0 and p denotes number of 2 we want to distribute which is x in our case). Number of solution of above equation is given by:
$\binom {p+l-1}{l-1}$
here p=10-(r+r-1) and l=r+1(slots) putting these value in above formula we get:
$\binom {11-r}{r}$
Now you can vary r from 0-10 and just add them you will get 144 as the answer. Here you can see you do not need to vary from 6 -10 because when we place 6 or more number we don't have enough 2's to put in between them so they will contribute 0.