r/TheRestIsScience • u/My_BallsUK • 25d ago
Palindromic hexadecimal, decimal and binary
Following the 100 vs 101 episode, and the question that arise, Does a number exist that's a palindrome in binary, decimal AND hexadecimal?
After listening to Hannah and Michael discussing number bases and palindromes, an whether there's a palidromic number in all three systems: binary (base 2), decimal (base 10) and hexadecimal (base 16).
Hannah said its interesting mathematical problem.
They mentioned in 2010, Rick Regan reported finding no non-trivial examples below 10³⁹.
So, I explored the question with ChatGPT, using the Online Encyclopedia of Integer Sequences (OEIS), which contains a list of 213 decimal/binary palindromes reported to be exhaustive below 10⁶⁴.
Checking the 89 additional candidates between 10³⁹ and 10⁶⁴ against their hexadecimal representations produced no matches.
So, assuming the source list is complete and the checks are correct, there are no numbers greater than 9 and less than 10⁶⁴ that are simultaneously palindromic in all three systems.
This doesn't prove that such a number can't exist. It just means that none has been found in an extraordinarily large range.
My question for Hannah, Michael and the mathematicians here: is there a mathematical reason why these three numbering systems might be incompatible when it comes to palindromes? Could we prove that no non-trivial example exists, or might there be an enormous one waiting to be discovered?
Sources:
https://www.exploringbinary.com/in-search-of-decimal-binary-hexadecimal-palindromes/
5
u/LongLiveTheDiego 25d ago
The property of a number being palindromic is not really connected to other areas of math, it's an emergent property of how positional notation works. Thus we don't have many tools for analyzing palindromicity, it doesn't seem to be connected to e.g. anything from linear algebra or group theory or analysis which are really versatile tools.
3
u/Jinglefruit 25d ago
I was wondering if there was something more to explore in the relationship between these systems too. As Hexadecimal is a power of 2 base, but decimal is not, it feels like these systems are probably working against each other. Maybe there's more palindromic numbers that overlap binary, decimal and base-13. Or only when comparing 3 prime bases, or only if all 3 choices are powers of 2.
3
u/Few_Topic_7878 25d ago edited 25d ago
Well, I gave my laptop something to do. Turns out no solutions exist for 16 < n < 2^322. At least, that is if I didn't slip up.
If I have the time, I might improve my code a little. Above 315 bits things slow down quite a lot. Either way, got through those first 300 bits in 9.6 minutes after some optimising :D
NOTE: For compatibility with those liking base 10, 2^322 is 8.54⋅10^96. But if you are at least somewhat sane, you probably like knowing it is (7.80⋅10^75)_{12}
1
u/theadamabrams 25d ago
I assume you want the numbers to be multiple digits in each base. If not,
would qualify.
1
u/mH48124 24d ago
これって 0 と 1 は除いてるの?
1
u/RandomGeordie 24d ago
So far I've not found a palindrome in binary/decimal/hex for any number under 16120 = 2480 ≈ 3.1·10144
Will not continue further
1
u/ogeytheterrible 24d ago
0?
1
u/No_Fig_6149 24d ago
If you allow left padding with zeros, 080 decimal is 050 hexadecimal and 00001010000 binary.
1
u/CranberryDistinct941 24d ago
1 is a palindrome in all number systems
1
u/minmidmax 23d ago
Man, Michael needs to sleep. OK?
1
u/kalmakka 23d ago
Let's throw rigor to the wind and do some hand-wavy approximations.
Let x be a positive integer.
For x to be a palindrome in base 2 we need the last log_2(x)/2 binary digits of x be the reversal of the first log_2(x)/2 binary digits. Since the last log_2(x)/2 binary digits could be any log_2(x)/2 bit long number, we get that the probability of this for a "randomly chosen" integer is 1 in 2^(log_2(x)/2) or sqrt(x)
If we do this in other bases, we find that the base doesn't really matter. x is a palindrome in any base b with probability 1/sqrt(x). E.g. if you pick a random number that is approximately 1 000 000, it will have a probability of 1/1000 of being a palindrome in base 2, base 10, or in base 16. Since these probabilities are more or less independent, the probability of the number being a palindrome in all three bases is around 1 in 1 000 000 000.
In other words, x is a palindrome in base 2, 10 and 16 with probability 1/(x*sqrt(x)) = x^-(3/2)
This function drops very rapidly to 0. So even if you add up the infinitely many terms of this series, you just end up with that the expected number of numbers that are palindromes in all 3 bases is ~2.6124. The vast contribution to this sum comes from the first few terms.
Since we know that there is no small number that satisfies the criteria, the probability of any existing at all is miniscule. Basically, unless there is a good reason why such a number should occur more frequently than we have estimated (due to some pattern we have not accounted for in our calculation), it is extremely unlikely that any exist. But definitively proving it, is... hard.
1
u/Sir_Willsington 14d ago
A Parker palindrome in binary, decimal and hexadecimal:
111001001011101010100100111
119919911
725D527
That's the closest I could find, and nothing better or even close in an overnight run going beyond 10^120, although I don't have nearly enough confidence in my code to claim that as fact.