How many palindromes of length 5 can be formed that contain 7 or 8?

421 Views Asked by At

I'm trying to figure out how many palindromes of length 5 can be formed that contain 7 or 8.

My reasoning is as follows:

The pool to choose from is $\{0,1,2,3,4,5,6,7,8,9\}$ and there are three positions that need to be filled out by these, with the exception that the number $7$ or $8$ must be used in one of the three (I assume at least once). Similarly, the first position cannot be filled by a $0$, so that leaves either the remaining options in the pool, or a $7$ or $8$. For either the second or third position, all options in the pool are available or, again, $7$ or $8$.

So, given that there are $3$ probable position that need to be filled by the required $7$ or $8$; that the first position can only be filled by $9$ options and either the second or third have $10$ options, but with one of these having being filled by the requirement, then:

$3*9*10*1 = 270$

Yet the answer is not correct. Where am I going wrong?

2

There are 2 best solutions below

0
On BEST ANSWER

The number of palindromes with at least an $8$ or a $7$ is the number of total palindromes minus the number of palindromes without $7$ or $8$.

To find the total number of palidromes the first terms can be anything but $0$. That's $9$ options. The second can be any thing. That's $10$ options and so can the third that's $10$. So there are $900$ possible palindromes. (Notice that the same number of numbers between $100... 999$. It's the exact same question.)

To find the total numbe of palindromes without $7$ or $8$ there are $7$ options for the first term. And $8$ for the second and third.

So $7*8*8$.

So there are $900 - 7*8*8 = 452$.

0
On

To answer your question: you are going wrong with just imposing a $3$ as some factor that comes in front of it. However, you are not dealing with palindromes that have multiple $7$s or $8$s.

To solve this I'll give you a hint: work out the total number of palindromes without the assumption on the 7 or 8. Afterward, you should work out the total number of palindromes containing not a $7$ and not an $8$ (which should work out similar to the first calculation). Subtract both results from each other and you have the correct result.

I hope this helps!