5

The decimal number 371 equals the hexadecimal number 0x173. The part that is relevant to me is that 371 is simply 173 backwards. Is this the only multiple digit decimal number that converts in this manner?

  • 2
    Are you willing to consider decimal numbers ending in one or more zeros, which then sort of disappear when put in the opposite order? If not, you don't need to look beyond three digits (since $16^4>10000$), so the question can be quickly settled with a computer search. – Harald Hanche-Olsen Sep 19 '13 at 14:20
  • I'm sorry, but I don't follow. 0x10000 is not the reverse of 65536. For instance, if the decimal is 65536, then the hexadecimal I would want is 0x63556, which is 65536 backwards. – seekerOfKnowledge Sep 19 '13 at 14:25
  • @HaraldHanche-Olsen Maybe my title with the word palindrome is totally off, but I couldn't come up with a different word for it. Like, when they are converted, the two together make a palindrome, or sorts. – seekerOfKnowledge Sep 19 '13 at 14:31
  • 1
    Are you interested in just bases 10/16, or in arbitrary bases? If the latter, there will be infinitely many two-digit examples (e.g. $32_a = 23_b$ is simply $3a+2=2b+3$ or $3a=2b+1$, so there's a solution corresponding to each multiple of $3$, and you can see how this generalizes to arbitrary two-digit palindromes) and it should be possible to use Pell's theorem to find infinitely many three-digit examples as well. Beyond three digits, things get murky fast... – Steven Stadnicki Sep 19 '13 at 15:03
  • 1
    seeker: Harald's point is that if the number you start with is greater than some fixed bound (though his 4-digit result is wrong, it can easily be shown to hold once you get to five hex digits), then the number of hex digits will always be smaller than the number of decimal digits - so unless you look at numbers with trailing decimal zeroes and 'evaporate' those in the hex number, it'll be impossible for the numbers (of two different lengths) to be reverses of each other. – Steven Stadnicki Sep 19 '13 at 15:06
  • @HaraldHanche-Olsen Your bounds are off slightly; you use $16^4\gt 10^4=10000$, but what you need is $16^n\gt 10^{n+1}$, which doesn't happen until $(1.6)^n\gt 10$, or $n\geq 5$; $16^5=1048576\gt 10^6$. – Steven Stadnicki Sep 19 '13 at 15:08
  • I am only interested in base 10 to base 16, yes. A friend of friend wrote a python script and came up with more examples. 53 = 0x35, 371 = 0x173, 5141 = 0x1415, 99481 = 0x18499. It only checked for numbers between 0 and 1,000,000, and of course the single digits were matched as well, but I'm not concerned with those. – seekerOfKnowledge Sep 19 '13 at 15:23
  • A follow-up question: why are they all multiples of 53? http://math.stackexchange.com/questions/1327887/decimal-hex-palindromes – Ned Batchelder Jun 16 '15 at 18:47

1 Answers1

3

Wrote a semi-quick python script to do some conversion and string manipulation for a simple search. Output is shown below:

$ ~/python:python test_hex.py
Enter start value in decimal: 0       
Enter ending value in decimal: 1000000
Dec: 0  --  Hex: 0x0  --  Result: True
Dec: 1  --  Hex: 0x1  --  Result: True
Dec: 2  --  Hex: 0x2  --  Result: True
Dec: 3  --  Hex: 0x3  --  Result: True
Dec: 4  --  Hex: 0x4  --  Result: True
Dec: 5  --  Hex: 0x5  --  Result: True
Dec: 6  --  Hex: 0x6  --  Result: True
Dec: 7  --  Hex: 0x7  --  Result: True
Dec: 8  --  Hex: 0x8  --  Result: True
Dec: 9  --  Hex: 0x9  --  Result: True
Dec: 53  --  Hex: 0x35  --  Result: True
Dec: 371  --  Hex: 0x173  --  Result: True
Dec: 5141  --  Hex: 0x1415  --  Result: True
Dec: 99481  --  Hex: 0x18499  --  Result: True

Reached 1000000 - End of script.

Note that 99,481 is just shy of 10% of the total range tested, none others are discovered in the remaining 90%. So to answer your question about multiple digit numbers, it appears there are four existing between the decimal values of 0 and 1,000,000.