# TAOCP 4.1 Positional Number Systems

> Study guide to TAOCP 4.1 Positional Number Systems. Number representations: binary, octal, hex, and exotic systems like negative bases, balanced ternary…

Updated October 20, 2026.

## Summary {#summary}

TAOCP 4.1 Positional Number Systems: Number representations: binary, octal, hex, and exotic systems like negative bases, balanced ternary, and mixed radix. Budget about 5 hours; do exercises 1, 9 and 2.

Knuth also covers a little history of how positional notation developed.

## Key facts {#key-facts}

- Week 74 of 145 on the cracked.guide path, in [TAOCP Vol 2: Seminumerical Algorithms](https://cracked.guide/taocp/volume-2).
- Time budget: about 5 hours.
- 34 exercises in the section, rated 00 to M40; the guide picks 8.
- Picked exercises with Knuth's triangle for recommended: 9, 2, 13, 19, 34 and 31.
- Before you start: 1.2.4 Integer Functions.

## Week 74 goals {#objectives}

By the end of week 74 you can:

- Compute representations of integers in base −2 and balanced ternary.
- Explain why negative bases and balanced ternary need no sign.
- Use mixed-radix notation to convert seconds into hours, minutes and seconds.

## This week's steps {#steps}

- Read §4.1 Positional Number Systems: Convert a few numbers to base -2 and balanced ternary by hand.
- Work the exercises (8 picked): Start with Ex 1, Ex 9, Ex 2; log what you solve below.
- Write down one thing you'd explain to someone: A few sentences in your own words in Your notes: the idea, why it works, an example. 30 words ticks this.

## Exercises {#exercises}

This section has 34 exercises, rated 00 to M40, and Knuth marks 8 of them with the triangle for recommended. Do the conversion drills quickly and then implement negabinary addition and the minimal signed-digit form; those are the exercises that pay back in code.

Worth your time:

- 1 (rated 15): Write small integers in base -2. Drill.
- 9 (rated 15, recommended): Octal to hexadecimal by regrouping bits.
- 2 (rated 24, recommended): Express a few numbers in four unusual systems. Shows the tradeoffs side by side.
- 11 (rated 22): Design negabinary addition.
- 13 (rated M21, recommended): Whether expansions in base -10 can be ambiguous, like 0.999... in decimal.
- 19 (rated 23, recommended): Which digit sets let every integer be written in a given base.
- 34 (rated 22, recommended): Write an integer with digits -1, 0, 1 using the fewest nonzero digits. Used in fast exponentiation and hardware multipliers.
- 31 (rated M35, recommended): 2-adic numbers as infinite two's complement. The stretch.

## Why it matters {#why}

Bit manipulation, encodings and serialization formats all depend on fluent radix thinking. Mixed radix is how you convert time units and index multi-dimensional arrays.

## Before you start {#before}

- 1.2.4 Integer Functions

## How to approach it {#approach}

Convert a few numbers to base -2 and balanced ternary by hand. Write a function that converts to any mixed radix.

## Common traps {#traps}

- Rushing through the negative-base examples. They are fun and they check your understanding.

## Links {#links}

- [Knuth's TAOCP page (editions, errata, MIX/MMIX)](https://www-cs-faculty.stanford.edu/~knuth/taocp.html)
- [Vol 2 errata (plain text, from Knuth)](https://www-cs-faculty.stanford.edu/~knuth/err2.textxt)
- [Wikipedia: Positional notation](https://en.wikipedia.org/wiki/Positional_notation)
- [Wikipedia: Balanced ternary](https://en.wikipedia.org/wiki/Balanced_ternary)
- [Wikipedia: Negative base](https://en.wikipedia.org/wiki/Negative_base)

---

Source: https://cracked.guide/guide/knuth-w057-0
cracked.guide: A free, dated 145-week path to getting genuinely cracked at programming.
