document.write( "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.\r
\n" );
document.write( "
\n" );
document.write( "\n" );
document.write( "How many positive $10$-digit numbers are cozy? \n" );
document.write( "
Algebra.Com's Answer #847652 by CPhill(1959)![]() ![]() You can put this solution on YOUR website! Let's break down the problem.\r \n" ); document.write( "\n" ); document.write( "**Observation 1:** A cozy number must contain at least one $3$. \r \n" ); document.write( "\n" ); document.write( "**Observation 2:** If a $3$ is in a position, the adjacent positions must also contain a $3$ to make the number cozy. \r \n" ); document.write( "\n" ); document.write( "**Observation 3:** A cozy number of length 10 can have a maximum of 5 $3$'s. \r \n" ); document.write( "\n" ); document.write( "**Case 1: One 3** \n" ); document.write( "* The $3$ can be in any of the 10 positions. \n" ); document.write( "* For each position, there are 9 choices for the other digits (any digit except $3$). \n" ); document.write( "* So, there are $10 \times 9^9$ possibilities.\r \n" ); document.write( "\n" ); document.write( "**Case 2: Two 3's** \n" ); document.write( "* The $3$'s must be adjacent. \n" ); document.write( "* There are 9 such pairs of positions (1-2, 2-3, ..., 9-10). \n" ); document.write( "* For the other 8 positions, there are 9 choices for each. \n" ); document.write( "* So, there are $9 \times 9^8$ possibilities.\r \n" ); document.write( "\n" ); document.write( "**Case 3: Three 3's** \n" ); document.write( "* The $3$'s must be in three consecutive positions. \n" ); document.write( "* There are 8 such triplets of positions. \n" ); document.write( "* For the other 7 positions, there are 9 choices for each. \n" ); document.write( "* So, there are $8 \times 9^7$ possibilities.\r \n" ); document.write( "\n" ); document.write( "**Case 4: Four 3's** \n" ); document.write( "* The $3$'s must be in two pairs of consecutive positions. \n" ); document.write( "* There are ${8 \choose 2}$ ways to choose the positions for the pairs. \n" ); document.write( "* For the other 6 positions, there are 9 choices for each. \n" ); document.write( "* So, there are ${8 \choose 2} \times 9^6$ possibilities.\r \n" ); document.write( "\n" ); document.write( "**Case 5: Five 3's** \n" ); document.write( "* The $3$'s must be in five consecutive positions. \n" ); document.write( "* There are 6 such quintuplets of positions. \n" ); document.write( "* For the other 5 positions, there are 9 choices for each. \n" ); document.write( "* So, there are $6 \times 9^5$ possibilities.\r \n" ); document.write( "\n" ); document.write( "Adding up all the cases, we get the total number of cozy 10-digit numbers:\r \n" ); document.write( "\n" ); document.write( "$10 \times 9^9 + 9 \times 9^8 + 8 \times 9^7 + {8 \choose 2} \times 9^6 + 6 \times 9^5$ \n" ); document.write( " \n" ); document.write( " |