This One Goes up to Three

In the world of computing, we’ve long accepted that two is enough. Binary - that austere system of 0s and 1s - powers every modern computer, smartphone, and smart toaster. It’s simple, reliable, and has been refined over decades into an industrial juggernaut. But what if I told you that two isn’t always the best number? What if there was a way to represent more information with the same number of digits, to make negation trivial, to sidestep the need for a separate sign bit?

That’s where ternary comes in. Base-3 computing.

And no, this isn’t just theoretical. I actually built one.

Not in hardware (yet), but in Python: a complete, runnable ternary computer simulator that executes programs written in a custom ternary assembly language. It uses balanced ternary - trits valued at −1, 0, and +1 as opposed to unbalanced ternary which has trits valued at 2, 1 and 0 - and runs demos ranging from a simple counter to a cellular automaton to a single-layer perceptron classifier. The whole thing is open source for educational purposes on GitHub: https://github.com/brandonssmith/ternary.

The title of this article is a nod to This Is Spinal Tap, where the band proudly shows off an amplifier whose knobs go up to eleven - “one louder” than the usual ten. Binary computing goes up to two (yes, I know it's actually 0, 1, but going up to 2 doesn't sound as good, nor as accurate). Ternary computing goes up to three. And in some ways, that extra state really does make things louder, richer, and occasionally more elegant.

Why Bother with Ternary?

Most people encounter ternary only in passing: as a mathematical curiosity, or perhaps in the context of old Soviet computers like the Setun (1958–1970), one of the few real-world ternary machines ever built at scale. The Setun and its successor, Setun-70, demonstrated that ternary could be more efficient than binary in terms of component count and power consumption -  but binary won the war of attrition anyway. Transistors got cheaper, binary circuits got simpler, and the ecosystem locked in.

Yet the idea never quite died. Every few years someone rediscovers balanced ternary and realizes it has properties that binary lacks:

Of course, there are downsides. Ternary logic is more complex to implement in hardware (three voltage levels instead of two), and the entire software ecosystem is built around binary. So why build a simulator in 2025?

Because it’s fun. Because it may now have actual applications in AI due to tokenization. Because it forces you to rethink basic assumptions. Because it’s a chance to play with an alternate reality where computers didn’t settle on two states. And because sometimes the best way to appreciate binary is to see what happens when you throw an extra state into the mix.

What This Simulator Does

The project is a from-scratch Python implementation of a simple ternary CPU emulator. It features:

All of it runs in pure Python - no external libraries required.

This one goes up to three.