Find the number of positive integers that satisfy both the following conditions:
Each digit is a 1 or a 2
The sum of the digits is 8
We can solve this problem using stars and bars. We have 8 stars, representing the digits of the number, and we need to divide them into 2 groups, representing the 2s and the 1s. We can do this in (2−18+2−1)=36 ways.
11111111 = 1 identifiable integer
1111112 = C(7,1) = 7 identifiable integers
111122 = C(6,2) = 15 identifiable integers
11222 = C (5,3) = 10 identifiable integers
2222 = 1 identifiable integer
34 integers