### Instruction: How many 10-digit positive integers have all digits either 1 or 2, and have two consecutive 1's?### Response: To solve this problem, I need to count how many ways I can arrange the digits 1 and 2 in a 10-digit number, such that there is at least one pair of adjacent 1's.
One way to approach this is to use the complement principle: subtract the number of 10-digit numbers with no consecutive 1's from the total number of 10-digit numbers with only 1's and 2's.
How many 10-digit numbers are there with only 1's and 2's?
Well, for each digit, I have two choices: 1 or 2.
So, by the multiplication principle, there are 2^10 = 1024 such numbers.
How many 10-digit numbers are there with no consecutive 1's?
This is a bit trickier, but I can use a recursive formula to find out.
Let N(n) be the number of n-digit numbers with no consecutive 1's, using only 1's and 2's.
Then, N(1) = 2, since I can have either 1 or 2 as the first digit.
N(2) = 3, since I can have 12, 21, or 22 as the two-digit number.
For n > 2, I can think of the n-digit number as the result of appending a digit to an (n-1)-digit number.
If the last digit of the (n-1)-digit number is 1, then I must append a 2 to avoid consecutive 1's.
If the last digit is 2, then I can append either a 1 or a 2.
So, N(n) = N(n-1) + N(n-2), for n > 2.
This is the same recurrence relation as the Fibonacci sequence, but shifted by one index.
Therefore, I can use the Fibonacci sequence to find N(10).
N(10) = F(11) = 89, where F(n) is the n-th Fibonacci number.
(I can use a calculator or a table to find F(11), or I can use the formula F(n) = (phi^n - (1-phi)^n) / sqrt(5), where phi is the golden ratio, about 1.618.)
So, the number of 10-digit numbers with no consecutive 1's is 89, and the number of 10-digit numbers with only 1's and 2's is 1024.
Therefore, by the complement principle, the number of 10-digit numbers with at least one pair of consecutive 1's is 1024 - 89 = 935.