Question 1208643: We call a number cozy if every digit in the number is either a $3$ or next to a $3.$ For example, the numbers $333,$ $83,$ $303,$ and $3773$ are all cozy, but the numbers $32423,$ $786,$ $340,$ and $3999$ are not cozy.
How many positive $10$-digit numbers are cozy?
Found 2 solutions by CPhill, ikleyn: Answer by CPhill(1959) (Show Source):
You can put this solution on YOUR website! Let's break down the problem.
**Observation 1:** A cozy number must contain at least one $3$.
**Observation 2:** If a $3$ is in a position, the adjacent positions must also contain a $3$ to make the number cozy.
**Observation 3:** A cozy number of length 10 can have a maximum of 5 $3$'s.
**Case 1: One 3**
* The $3$ can be in any of the 10 positions.
* For each position, there are 9 choices for the other digits (any digit except $3$).
* So, there are $10 \times 9^9$ possibilities.
**Case 2: Two 3's**
* The $3$'s must be adjacent.
* There are 9 such pairs of positions (1-2, 2-3, ..., 9-10).
* For the other 8 positions, there are 9 choices for each.
* So, there are $9 \times 9^8$ possibilities.
**Case 3: Three 3's**
* The $3$'s must be in three consecutive positions.
* There are 8 such triplets of positions.
* For the other 7 positions, there are 9 choices for each.
* So, there are $8 \times 9^7$ possibilities.
**Case 4: Four 3's**
* The $3$'s must be in two pairs of consecutive positions.
* There are ${8 \choose 2}$ ways to choose the positions for the pairs.
* For the other 6 positions, there are 9 choices for each.
* So, there are ${8 \choose 2} \times 9^6$ possibilities.
**Case 5: Five 3's**
* The $3$'s must be in five consecutive positions.
* There are 6 such quintuplets of positions.
* For the other 5 positions, there are 9 choices for each.
* So, there are $6 \times 9^5$ possibilities.
Adding up all the cases, we get the total number of cozy 10-digit numbers:
$10 \times 9^9 + 9 \times 9^8 + 8 \times 9^7 + {8 \choose 2} \times 9^6 + 6 \times 9^5$
Answer by ikleyn(52776) (Show Source):
|
|
|