In my article “Counting Binary and Hexadecimal Palindromes” I derived formulas for counting binary palindromes and hexadecimal palindromes. For each type of palindrome, I derived two pairs of formulas: one pair to count n-digit palindromes, and one pair to count palindromes of n digits or less.
In this article, I will derive similar formulas to count binary/hexadecimal palindromes — multi-base palindromes I’ve shown to have an algorithmically defined structure.
Continue reading …
Binary/hexadecimal palindromes are integers that are palindromic in both binary and hexadecimal. Unlike binary/decimal palindromes, for example, they have a predictable structure. This means they can be generated directly, rather than searched for. So what is their structure?
Certainly they’re made up of the hexadecimal digits that are themselves palindromic in binary: 0, 6, 9, F; for example, F060F16 = 111100000110000011112 and 9F916 = 1001111110012. Each of these four hexadecimal digits maps neatly to a 4-digit binary palindrome, so any hexadecimal palindrome made from them is automatically palindromic in binary.
But there are other binary/hexadecimal palindromes, like 52516 = 101001001012 and 7020716 = 11100000010000001112, that contain hexadecimal digits that are not palindromic in binary. In this case, binary palindromes are produced with combinations of hexadecimal digits. It turns out there are a limited number of valid combinations, and that they’re localized — they span only two hexadecimal digits.
In this article, I’ll analyze binary/hexadecimal palindromes and describe their structure — a structure due to the relationship of the two bases, binary and hexadecimal.

Example Binary/Hexadecimal Palindromes
Continue reading …
How many nonzero, n-digit, decimal number palindromes are there? These two formulas give the answer:
- When n is even: 9·10n/2-1
- When n is odd: 9·10(n+1)/2-1
How many nonzero, decimal number palindromes are there, consisting of n-digits or less? These two formulas give the answer:
- When n is even: 2(10n/2 – 1)
- When n is odd: 11·10(n-1)/2 – 2
So for example, there are 900 5-digit decimal palindromes, 9,000 8-digit decimal palindromes, 1,098 decimal palindromes of 5 digits or less, and 19,998 decimal palindromes of 8 digits or less.
In this article, I will derive similar formulas to count binary and hexadecimal number palindromes.
Continue reading …
People have been tweeting about the upcoming dates that look like binary numbers. 10/10/10 seems to be a favorite, both because of its symmetry and because 101010 = 42 in decimal (you know, the answer to the ultimate question of life, the universe, and everything). Here are the nine dates in each year, interpreted as binary numbers, and with their decimal equivalents:
Continue reading …
In my article “Nines in Binary”, I proved the following: positive integers of the form 10n-1, that is, integers made up of n digits of 9s, have binary representations with exactly n digits of trailing 1s. Pat Ballew made a clever observation, adapting my result to prove an equivalent statement for base 5 (quinary): positive integers of the form 10n-1 have quinary representations that have exactly n digits of trailing 4s. For example, 9999 in decimal is 304444 in quinary.
In “Nines in Binary”, I derived an expression for 10n – 1 that shows its structure as a binary number:
10n – 1 = (5n – 1) 2n + (2n – 1)
Pat derived a similar expression for 10n – 1 that shows its structure as a quinary number:
10n – 1 = (2n – 1) 5n + (5n – 1)
In essence, he swapped the 2s and 5s, making it the “dual” of my formula, if you will.
I’ll show the details of the derivation and prove why the formula works.
Continue reading …
A palindromic number, or number palindrome, is a number like 74347, which is the same written forward and backward.
A number can be palindromic in any base, not just decimal. For example, 101101 is a palindrome in binary. A number can also be palindromic in more than one base, like decimal 719848917, which is 101010111010000000010111010101 in binary and 5272002725 in octal.
An efficient way to find palindromes in a single base is to generate them, iterating through each integer and constructing palindromes from them. An efficient way to find numbers that are palindromic in multiple bases is to take a palindrome in one base and test if it’s a palindrome in one or more additional bases.
In this article, I’ll show you C code I wrote that finds multi-base numeric palindromes. I used this code to generate tables of numbers that are palindromic in decimal and binary, decimal and hexadecimal, and decimal and octal. I also used this code to solve Euler problem 36, which asks for the sum of all numbers, less than one million, that are palindromic in decimal and binary.
Continue reading …
The following is a visual depiction of the binary integers 0 through 11111111:

Binary Integers 0-11111111
A nice pattern, right? I generated it based on the image found on page 117 of Stephen Wolfram’s “A New Kind of Science”. I’ll discuss its structure in detail in this article.
Continue reading …
Here is a table you can use to convert small integers — integers between 0 and 255 — directly between decimal and binary (as an alternative to using a decimal/binary converter):
Continue reading …
I discovered a cool property of positive integers of the form 10n-1, that is, integers made up of n digits of 9s: they have binary representations that have exactly n digits of trailing 1s. For example, 9,999,999 in decimal is 100110001001011001111111 in binary.
The property is interesting in and of itself, but what is more interesting is the process I went through to discover it. It’s a small-scale example of experimental mathematics: I observed something interesting, experimented to collect more data, developed a hypothesis, and constructed a proof.
Continue reading …
Wolfram Alpha can do many types of calculations, including conversions between numbers in different bases. I’ll demonstrate by showing examples of decimal to binary and binary to decimal conversion.
Continue reading …
I introduced my mother to binary numbers a few weeks ago when I showed her my One Hundred Cheerios in Binary poster. It shows the decimal number 100 in binary — 1100100. She’s not an engineer but she’s good with numbers, so I knew she would get it — if only I could find the right way to explain it. Two days ago, I found the right way.
Continue reading …
Did you know you can use Google as a calculator? Type 1 + 2 + 4 + 8 + 16 + 32 into Google’s search box and you’ll get 63 as the result.
Did you know you can use the calculator with numbers in different bases? It can convert numbers between decimal, binary, hexadecimal, and octal, as well as do arithmetic in those bases. To work in a non-decimal base, just prefix numbers as follows: 0b for binary, for example, 0b1010; 0x for hexadecimal, for example, 0xFF; and 0o for octal, for example, 0o701.
Continue reading …