A positive whole number that is the same when reading from right to left and left to right is called a palindromic number. If all of them were put into a sequence that is from small to big:1,2...11,22...,101,111...,10001,10101,.....
Then which term is the number 78987 in this sequence? For example : 1 is the 1st term,2 is the second....etc
Starting with 0, 78987 is the 889th palindrome
[BTW...889 is known as the palindrome's rank ]
Starting with 1, it is the 888th palindrome
This can be verified with the calculator here :
http://rhyscitlema.com/algorithms/generating-palindromic-numbers/
[ The calculator is about half-way down the page.....there are also other intems of interest related to palindromes on this page ]
A procedure is desribed for finding the nth palindrome, but I don't see one that tells us how to determine the rank of any particular palindrome [ although I did not look at the page with a fine tooth comb]
Maybe heureka knows of a proceedure to produce this???
which term is the number 78987 in this sequence?
Here 0 is the 1st term:
The position of a palindrome within the sequence can be determined almost without calculation:
If the palindrome has an even number of digits,
prepend a 1 to the front half of the palindrome's digits.
Examples: 98766789=a(19876)
If the number of digits is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit.
Examples: 515=a(61), 8206028=a(9206), 9230329=a(10230).
see link: http://oeis.org/search?q=Palindromes+in+base+10
which term is the number 78987 in this sequence?
The number of digits is 5 is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit.
\(\begin{array}{|rrrrll|} \hline & & & \Rsh & & \text{ until central digit} \\ &7 & 8 & 9 & 8 & 7 \\ &| & | & | \\ &+1 & | & | \\ &\downarrow & \downarrow & \downarrow \\ \text{term is } & \color{red}8 &\color{red}8 &\color{red} 9 \\ \hline \end{array} \)
Starting with 1, it is the 888th palindrome