0

Can we find the count of palindrome numbers in the range [a,b] by directly using a formula.

for eg in range [8,12] there are 3 palindrome numbers (8, 9, 11)

ppSpp
  • 821
  • 2
    Have you tried to look for one yourself? Maybe start with something easy, like limiting $a$ and $b$ to being powers of $10$. – Arthur Mar 22 '20 at 14:17
  • Yes i tried but not able to find something – ppSpp Mar 22 '20 at 14:47
  • 1
    You tried, but can't find a nice way to calculate the number of 3-digit palindromes? Four-digit? Five-digit? It really isn't that hard. – Arthur Mar 22 '20 at 14:50
  • for n digit it's easy but in range [a,b] I can't find – ppSpp Mar 22 '20 at 14:54
  • 3
    Well, the idea for the general case is more or less the same, but the actual formulas are going to get ugly because it's difficult to extract any kind of digit information by using formulas (most tools we have for building formulas do not care about what base you use for numbers, which is actually a great thing in 99.9% of cases). Maybe it's easier to start with describing a step-by-step algorithm in words instead of formulas. I think that would be easier for everyone, both for you and for whoever you might be planning on showing it to. – Arthur Mar 22 '20 at 14:56

0 Answers0