23-09-09 What is the 10000th palindrome?

What is the 10000th palindrome?

PS: 131, 1441, 1020201 etc are palindromes...

which are the same from both sides :)

18 Answers

62
Lokesh Verma ·

I cant stand seeing this one unsolved... [2]

I have to give the solution now...

Let us see the number of 1 digit palindromes : 9
Number of 2 digit palindromes : 9
Number of 3 digit palindromes : 9 x 10 = 90
Number of 4 digit Palindromes : 90
Number of 5 digit Palindromes: 900
Number of 6 digit Palindromes: 900

Number of 7 digit Palindromes: 9000

So what is obvious is that it will be a 7 digit number..

Now what is not obvious is how to go about from here...

Let us revisit the palindromes...

If I fix the first digit, the last digit also gets fixed...

So what is the number of 7 digit palindromes with 1st digit as 1? (10^3=1000)

Number of palindromes with < 7 digits = 1998

So we have to find the 10000-1998 = 8002 th palindrome...

So we have 1000 7 digit palindromes starting with 1, 2, ... 8, 9

we need to find the 8002th

which means that we have to find the 2nd 7 digit palindrome starting with 9

The smallest such palindrome would be 9000009

By simple observation, you can say that the 2nd smallest such palindrome would be 9001009

[1]

62
Lokesh Verma ·

even my solution?

I thought that was not so difficult!

24
eureka123 ·

everyhting gone over my head

62
Lokesh Verma ·

bhargav.. this is not that simple..

I had a reccursion in my mind that the nth palindrome of m digits will be very closely related to the palindromes of m-1 digit..

as is suggested by the solution that i have given..

but the problem was how to relate those..

http://eric-schmidt.com/eric/palindrome/index.html

I stopped thinking after seeingthis paper (given by anant sir) and happens to be the 1st search result on nth palindrome :)

39
Dr.House ·

the only hard thing
is distinguishing between palindromes with an even and odd number of digits
finding the nth palindrome with an even number of digits is easy; it's just n, and then n reversed
similarly finding the nth palindrome with an odd number of digits is easynow you have to count how many of each digit there are in order to determine where the nth palindrome is
it's a tedious calculation

39
Dr.House ·

let me see , i think theres a way...

66
kaymant ·

[1]

62
Lokesh Verma ·

You have asked me this .. and we know how difficult this one is :D [1]

I could not dare to read 2 pages of those expressions :D

66
kaymant ·

What about an arbitrary n?

66
kaymant ·

The 10000th palindrome is 9001009. I have assumed 1 as the first palindrome and an ascending order arrangement for the palindromic numbers.

62
Lokesh Verma ·

lol..

The problem is that if i give a hint.. it will give the whole solution :(

Can you tHink of some recurrsion

24
eureka123 ·

sir cant get that elephant hint..............

i just know one thing that it will lie b/w 106 and 107 ...but how to take it further ??

62
Lokesh Verma ·

no one seems to be interested :(

even when i thought this was easier than most other QOD's that I have given!!

62
Lokesh Verma ·

lol.. there is no need of a program.. you just have to find a small clue..

I will give a hint to begin with

there are 9 palindromes of 1 digit...

Now can you take it further?

1
Grandmaster ·

can make a simple C program to do thatif tired of doing mentally[3]

1
$ourav @@@ -- WILL Never give ·

ok,sir...i will try

62
Lokesh Verma ·

I guess you should try this a bit more..??

[1]

Hint: This works more like the question where you ahve to find the position of Elephant among all words that can be made by the letters in Elephant..

1
$ourav @@@ -- WILL Never give ·

sir,can u explain it??

Your Answer

Close [X]