The most common way to represent hexadecimal (or any other base > 10) numbers is to use the first letters of alphabet for the extra digits. However, this doesn’t work well for my brain that insists that since A is the first letter, B is the second letter… then A = 10 + 1, B = 10 + 2… so I keep having to remember to shift this by one, and judging by the responses to my toot about it, it seems that I’m not alone.
I don’t think that I’ve made any useless invention that people would randomly find and say “oh, hey, what a nice unrealistic idea”. It’s time to make one! I present to you: the X-alpha hexadecimal notation!
Let’s start with the digits of the traditional hex notation:
0 1 2 3 4 5 6 7 8 9 A B C D E F
The Hindu-Arabic numerals are fine. The letters have the “shift” effect, so let’s move them to the places that work better for my decimal brain:
0 1 2 3 4 5 6 7 8 9 … A B C D E
However, this creates a gap: what to use for 10? I’ve been thinking about it and realized that we have a well-known symbol for 10 already! The sequence becomes:
0 1 2 3 4 5 6 7 8 9 Ⅹ A B C D E
However, this system has a significant flaw: it’s easy to confuse a number with the ABCDEF notation. So let’s replace the Latin letters with, say, Greek letters — and I just happen to remember the first five! Let’s use lowercase forms though since they’re more easily distinguished from the Latin alphabet.
0 1 2 3 4 5 6 7 8 9 Ⅹ α β γ δ ε
Tadaam! Finally, a quick way to convert between the standard and X-alpha representation in Python:
"0x3f7a5d".translate(str.maketrans("abcdef", "Ⅹαβγδε"))
…and the other way around:
"3ε56Ⅹγ".translate(str.maketrans("Ⅹαβγδε", "abcdef"))
Enjoy!
Hmm.
Is 0X11 the sixteen-bit number 2577 or seventeen in hex ?
Yeah, this ambiguity is a known problem, although using “0x” makes little sense if you’re using non-standard symbol set anyway.