Number Bases Stretch The Mind

Some of us might solve crossword puzzles or Sudoko games to exercise our minds, but [Nathan Nichols] plays with exotic number systems to keep the brain cells in shape. He wrote the Hanoi C99 library while in high school, implementing several of his favorites.

We have all been using decimal (base 10) and duodecimal (base 12, as in clocks) since before grade school. Us computer geeks are also adept at various computer-friendly systems like binary, octal, and hexadecimal. The true nerds among us will be familiar with systems like vigesimal (base 20 Mayan numerals) and sexagesimal (base 60 Babylonian numbers). We ourselves espoused the virtues of seximal (base 6) a couple of years ago. But if you really want to stretch your mind, take a dive into the weird number systems that [Nathan] has been exploring.

Negabinary (base -2)

The lowest level of weirdness in the group, this one is almost normal. Its the same as binary, except the bit weights have alternating signs: { 1, -2, 4, -8, ... }.

Binarions (base -1+i)

Or base -1+j if you studied electrical engineering. The use of complex numbers as radices was proposed by Donald Knuth way back in 1955. We find it really hard to imagine this one being helpful.

Fibonacci base

Numbers can also be represented by the summation of a sequence of Fibonacci numbers. Using this system, a number can sometimes be represented more than one way, so watch out.

Stern-Brocot tree

A number is represented by its path down the Stern-Brocot tree. One feature of this system is that numbers can be exact. For example, the Stern-Brocot tree representation of one-third has a finite number of digits.

While [Nathan]’s library only performs conversion at input or output, we wonder if someone will take this further and implement an arithmetic unit inside an FPGA. Besides being a fun exercise, it would baffle someone casually trying to reverse engineer your secret calculations. Let us know of any strange number systems you have used or encountered.