Counting the palindromes

How many palindromes or palindromic numbers are there between 4×10⁴ and 6×10⁶ ? Here , a palindromic number (also known as a numeral palindrome or a numeric palindrome) is a number (such as 16461) that remains the same when its digits are reversed.


The answer is 6500.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Sathvik Acharya
Jan 16, 2021

4 × 1 0 4 < N < 6 × 1 0 6 40000 < N < 6000000 \begin{aligned} 4\times 10^4&<N<6\times 10^6 \\ \implies 40000&<N<6000000 \end{aligned} Case 1: N N is a 5 5 -digit palindrome.

N \;\;\;\;\;\;\;\;\;\;N is of the form a b c b a \overline{abcba} where 4 a 9 , 0 b 9 4\le a\le 9,\; 0\le b\le 9 and 0 c 9. 0\le c\le 9. So the total number of possibilities for N N in this case is 6 × 10 × 10 = 600 6\times 10\times 10=600 .


Case 2: N N is a 6 6 -digit palindrome.

N \;\;\;\;\;\;\;\;\;\;N is of the form a b c c b a \overline{abccba} where 1 a 9 , 0 b 9 1\le a\le 9,\; 0\le b\le 9 and 0 c 9. 0\le c\le 9. So the total number of possibilities for N N in this case is 9 × 10 × 10 = 900 9\times 10\times 10=900 .


Case 3: N N is a 7 7 -digit palindrome.

N \;\;\;\;\;\;\;\;\;\;N is of the form a b c d c b a \overline{abcdcba} where 1 a 5 , 0 b 9 , 0 c 9 1\le a\le 5,\; 0\le b\le 9,\;0\le c\le 9 and 0 d 9. 0\le d\le 9. So the total number of possibilities for N N in this case is 5 × 10 × 10 × 10 = 5000 \\ \;\;\;\;\;\;\;\;\;\; 5\times 10\times 10\times 10=5000 .


Therefore, there are 600 + 900 + 5000 = 6500 600+900+5000=\boxed{6500} palindromic numbers between 4 × 1 0 4 4\times 10^4 and 6 × 1 0 6 6\times 10^6 .

Verification

1
2
3
4
def is_a_palindrome(N):
    return str(N)==str(N)[: :-1]
Palindrome=[N for N in range(4*10**4, 6*10**6)if is_a_palindrome(N)]
print(len(Palindrome))

Sathvik Acharya - 4 months, 3 weeks ago

Log in to reply

I solved it in the same way !.!.!.!

Sudipto Podder - 4 months, 3 weeks ago

I think at the end of case 3 you have messed with the term '1000' . It should be 5000. However it's really negligible !.!.!.

Sudipto Podder - 4 months, 3 weeks ago

Log in to reply

Thanks, I have corrected it :)

Sathvik Acharya - 4 months, 3 weeks ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...