Number of palindromes less than $10^9$

How many positive palindromes are less than $$1,000,000,000$$?

I think one way to do this is to count palindromes with a fixed number of digits, and take the sum of these values from $$1$$ digit to $$8.$$ I was trying to come up with a formula to get the answer so I said if we have $$[a_1][a_2][a_3]...[a_n]...[a_3][a_2][a_1],$$ the only digit that cannot be $$0$$ is $$a_1.$$

I started learning what a palindrome was and I thought of this question. I am not sure how to get an answer and what the formula would be. I was thinking would these be a combination question. Is there anyway we can do this? Can someone help me with this?

• Use a comoputer program? :P Oct 28, 2014 at 0:55
• 123454321 is a palindrome, is less than 1,000,000,000, and is more than 8 digits. So what you've got doesn't work. Oct 28, 2014 at 0:57
• I.e. the sum of Number of n-digit palindromes for $n$ up to $9$. Sep 3, 2020 at 17:54
• A more general question was asked before: Palindromes of Length Less Than or Equal to N. Sep 4, 2020 at 13:14

2 Answers

Before beginning, note that in questions like these, we prefer to say that leading zeroes are not written. That is to say that we do not consider $00500$ a palindrome number since it could be reduced to $500$, ignoring the zeroes on the left.

Break this into cases: it is 1 digit long, it is 2 digits long, it is 3 digits long, $\cdots$, it is 9 digits long, (and it is 10 digits long)

In the case of it being five digits long we have:

__, __, __, __, __

The furthest left digit must match the furthest right, the second on the left must match the second on the right, and the one in the middle could be anything.

By the multiplication principle, http://en.wikipedia.org/wiki/Rule_of_product, you can break this into steps. Step 1: Choose the first digit (any digit 1-9, in doing so, that forces the last digit to be the same), Step 2: Choose the second digit (any digit 0-9, in doing so, that forces the second to last digit to be the same), Step 3: Choose the digit in the middle (any digit 0-9).

Note also that in step 1, the first digit is not allowed to be a zero, but in all other cases it is allowed.

So, we have for the case of a 5 digit palindrome number, $9\cdot 10 \cdot 10\cdot 1 \cdot 1$ number of possibilities.

Repeat this process for all other cases and add them together for the total amount.

Note also for the case of it being 10 digits, you will also need to check that it is less than 1,000,000,000. You should quickly notice that since 1,000,000,000 is the smallest 10 digit number, and is not itself a palindrome, all other 10 digit numbers are not smaller than 1,000,000,000 and thus are ignored for the purposes of this problem.

every number $n$ where $0<n<1,000,000,000$ has 1-9 digits.

There are 9 one digit palindromes, sense their are 10 digits and 0 is not positive.

All two digit palindromes have a AA pattern, so their are 9 of those too.

Three digits gives a ABA pattern, A can be any number from 1-9 and B Any from 0-9, wich gives $9*10=90$ possible palindromes.

Four gives ABBA for $9*10=90$ more combinations.

Five is ABCBA. That yields $9*10*10=900$.

Six would be $900$ again.

Seven and eight each yield another $9,000$

Lastly, nine digits will make a ABCDEDCBA pattern for $90,000$

So that would make $9+90+90+900+900+9000+9000+90000=109989$ in all.