ArticlesProjectsWeeklyCredentialsAbout
zusez1early-computershardwarebinaryfloating-pointmechanical-computing

The Thinking Machine Chronicles #0003: Gears and Logic: Konrad Zuse Builds the World's First Programmable Computer

·11 min read
Replica of the Zuse Z1 mechanical computer on display at the Deutsches Technikmuseum, Berlin

Replica of the Zuse Z1 at the Deutsches Technikmuseum, Berlin, where Konrad Zuse's 1938 mechanical binary computer, built in his parents' living room. Stahlkocher, CC BY-SA 3.0, via Wikimedia Commons.

The Thinking Machine Chronicles · Era I: Foundations (1936–1949)

The World in 1938

In 1938, Europe's political order was collapsing in slow motion. Hitler annexed Austria in the Anschluss of March, absorbing eleven million German-speakers into the Reich without a shot fired. By September he had forced the international community to hand him Czechoslovakia's Sudetenland at Munich, Chamberlain's infamous "peace for our time" capitulation that bought eleven months but no peace. In November, Kristallnacht, the coordinated destruction of Jewish businesses and synagogues across Germany, shattered the last pretence that persecution was containable. Japan's war in China had entered its second year, with the Nanjing Massacre still fresh in international memory. In the United States, the economy was still limping from the 1937 "Roosevelt Recession," with nine million still unemployed. And in Berlin's Kaiser Wilhelm Institute, Otto Hahn and Fritz Strassmann were weeks away from discovering nuclear fission, news that would reach Lise Meitner in exile in Sweden and trigger a calculation that would, seven years later, end the war.

The intellectual ground of computing had shifted twice in the preceding two years, though almost nobody knew it yet. In Cambridge, a 24-year-old named Alan Turing had published his computable numbers paper in 1936, defining the outer limits of what any algorithm could ever do. In Boston, a 21-year-old named Claude Shannon had shown in 1937 that Boolean algebra was the correct mathematical language for designing switching circuits. Both men had worked entirely in the abstract. Nobody had yet built a machine that embodied their ideas, a general-purpose, programmable, binary computer that executed arbitrary sequences of instructions from a stored program. That problem fell to a young German civil engineer, alone in his parents' living room in Kreuzberg, who had never heard of either paper.

Gears and Logic: Konrad Zuse Builds the World's First Programmable Computer

While Turing was theorising in Cambridge and Shannon was algebraising circuits in Boston, Konrad Zuse was building: with his hands, with no institutional support, financed by his parents, guided by no prior art he was aware of. He had not read Turing's paper. He had not read Shannon's thesis. He arrived at binary arithmetic, floating-point representation, and stored-program execution independently, through sheer engineering intuition.

The machine he produced, the Z1, was not a theoretical construct. It had gears. It clanked. It was unreliable. And it was the first general-purpose, programmable, binary, floating-point computer in the world.


The Problem Zuse Was Solving

Zuse was trained as a civil engineer. Before he touched a metal plate, he understood the kind of calculation his profession required: load calculations for bridges, stress analysis for structural beams, iterative approximations. All of it was done by hand, with logarithm tables, by rooms full of human "computers", a job title at the time.

He wrote in his memoir: "I was too lazy to calculate."

This is the correct kind of laziness. Not the laziness that avoids work, but the engineering laziness that recognises when a task is mechanical enough to be automated, and then builds the automaton.

His insight was that all such calculations could be reduced to four arithmetic operations on numbers stored in a systematic way, and that these operations themselves could be reduced to logical operations on binary digits. The key word was binary. Zuse independently discovered what Leibniz had noted 250 years earlier and Shannon was formalising simultaneously: binary representation makes logic physical. A circuit, or a metal strip, is either conducting or it isn't. A gear tooth either engages or it doesn't. Two states are easier to build reliably than ten.


The Z1 Architecture

The Z1 was a 22-bit floating-point computer. Every number was stored in a 22-bit word divided into three fields:

s1 bit  e6e5e4e3e2e1e07 bits (exponent)  m13m12m014 bits (mantissa)\underbrace{s}_{1\text{ bit}} \;\underbrace{e_6 e_5 e_4 e_3 e_2 e_1 e_0}_{7\text{ bits (exponent)}} \;\underbrace{m_{13} m_{12} \cdots m_0}_{14\text{ bits (mantissa)}}

The value represented was:

(1)s×(1.m13m12m0)2×2(e64)(-1)^s \times (1.m_{13}m_{12}\cdots m_0)_2 \times 2^{(e - 64)}

where ee is the 7-bit exponent value (biased by 64, giving a range of 2642^{-64} to 2632^{63}) and the mantissa has an implicit leading 1 for normalised numbers, exactly the convention that IEEE 754 would later standardise in 1985, almost five decades later.

This was not an accident of convention. Zuse had worked out that this normalised form minimised wasted precision and simplified the hardware for the arithmetic unit.

Memory: 64 Registers of Sheet Metal

The Z1's memory consisted of 64 registers, each storing one 22-bit value. The medium was thin plates of sheet metal, each plate representing one bit as a mechanical position. A plate shifted left meant 0; shifted right meant 1. The memory was read by a comb of metal fingers that sensed the position of each plate.

This was not a drum, not a tube, not a relay. It was literally metal plates in an array, pushed by rods. Zuse cut the plates himself, filing and fitting each one.

Arithmetic Unit: Binary Adder from First Principles

The arithmetic unit performed binary addition using a carry-ripple mechanism. A single-bit full adder takes three inputs, aa, bb, cinc_{in}, and produces two outputs:

sum=abcin\text{sum} = a \oplus b \oplus c_{in} cout=(ab)(bcin)(acin)c_{out} = (a \wedge b) \vee (b \wedge c_{in}) \vee (a \wedge c_{in})

In the Z1, these logical operations were implemented as mechanical linkages: pins that blocked or passed motion depending on the position of input plates. Chain 22 such single-bit stages together and you have a 22-bit ripple-carry adder, with a latency proportional to the longest carry chain.

Multiplication was implemented as repeated addition with shifts, analogous to long multiplication. Division was iterated subtraction with shift-and-compare. All of this was mechanical, running at approximately 1 Hz, one operation per second, driven by an electric motor turning a crankshaft.

Program Tape: Stored Instructions on Film

Zuse's third breakthrough was separating the program from the machine. The Z1 read instructions from punched 35mm cinema film. Not purpose-built paper tape: discarded movie film, which was cheap and available. Each frame encoded an 8-bit instruction: opcode plus memory address.

The instruction set was minimal:

  • LOAD rr: load memory register rr into accumulator
  • STORE rr: store accumulator to memory register rr
  • ADD rr: accumulator += memory[rr]
  • SUB rr: accumulator -= memory[rr]
  • MUL rr: accumulator *= memory[rr]
  • HALT: stop

This is the stored-program concept. Not a fixed circuit solving one problem, not a plugboard rewired for each task, but a program, a sequence of instructions encoded in a medium, read sequentially, directing the machine through arbitrary computations. Zuse invented this before ENIAC, before the EDVAC report, before von Neumann's name was attached to the architecture.


A Python Model of the Z1

The code project for this article implements a faithful simulation of the Z1's key systems:

# Z1 22-bit floating-point format
@dataclass
class Z1Float:
    sign: int       # 0 or 1
    exponent: int   # 7-bit biased by 64
    mantissa: int   # 14 bits, implicit leading 1

    @staticmethod
    def from_python(value: float) -> "Z1Float":
        if value == 0.0:
            return Z1Float(0, 0, 0)
        sign = 1 if value < 0 else 0
        abs_val = abs(value)
        e = math.floor(math.log2(abs_val))
        mantissa_float = abs_val / (2 ** e) - 1.0
        mantissa_int = round(mantissa_float * (2 ** 14))
        raw_exp = e + 64
        return Z1Float(sign, raw_exp, mantissa_int)

The gate-level ripple-carry adder works bit by bit, exactly as Zuse's mechanical linkages did:

def full_adder_gate(a: int, b: int, cin: int) -> tuple[int, int]:
    total = a ^ b ^ cin
    carry = (a & b) | (b & cin) | (a & cin)
    return total, carry

def ripple_carry_adder(a_bits, b_bits):
    result, carry = [], 0
    for a, b in zip(a_bits, b_bits):
        s, carry = full_adder_gate(a, b, carry)
        result.append(s)
    return result, carry

And the program tape executor runs an instruction sequence on simulated memory cells:

# Compute (3×4) + (2×5) = 22
tape = [
    Instruction(OP_LOAD, 0),   # ACC = 3
    Instruction(OP_MUL,  1),   # ACC = 12
    Instruction(OP_STORE, 4),  # tmp = 12
    Instruction(OP_LOAD, 2),   # ACC = 2
    Instruction(OP_MUL,  3),   # ACC = 10
    Instruction(OP_ADD,  4),   # ACC = 22
    Instruction(OP_HALT),
]

Running this trace produces exactly 22.0; the machine is working correctly.


The Tragedy of the Z1

The Z1 was demonstrated to friends and colleagues in 1938. It worked, inconsistently, frustratingly, but it worked. The mechanical tolerances Zuse could achieve with hand tools were barely sufficient. A small warp in a metal plate could cause a bit error that corrupted an entire calculation.

Zuse moved on. He built the Z2 with telephone relay switches (1940), then the Z3 (1941), the world's first functional programmable, binary, floating-point computer, built entirely from 2,600 telephone relays. The Z3 ran reliably at 5–10 Hz. It could compute the inverse of a matrix. It was used for wing flutter calculations for the Nazi aircraft industry.

The original Z1 was destroyed in the Allied bombing of Berlin in 1943. Zuse rebuilt a replica from memory in 1989; it now sits in the Deutsches Technikmuseum in Berlin.

The Z3 was also destroyed in 1943. The Nazis, when briefed on Zuse's work, declined to classify it as war-critical and provide resources. They did not understand what they had. The computing revolution that might have happened in Germany in the 1940s happened instead in America and Britain, built on different foundations, by people who had, for the most part, never heard of Konrad Zuse.

Paper: Konrad Zuse described his Z1 and Z3 designs in Der Plankalkül (1945/1948), an unpublished manuscript that also contained the world's first high-level programming language. It was not published until 1972, long after FORTRAN and ALGOL had been invented independently. Zuse received the Kyoto Prize in 1987 and the IEEE Computer Pioneer Award in 1986.


Why It Mattered

Zuse's work established three principles that every computer since has inherited:

  1. Binary floating-point is the right representation for general scientific computation. The 22-bit Z1 format anticipated IEEE 754 by 47 years.
  2. Stored programs: instructions encoded in a medium and read sequentially decouple the machine from any particular task.
  3. Hardware can be built by one person, without institutional support, from first principles. This is perhaps the most dangerous idea of all: that you do not need permission to build a thinking machine.

The Z1 ran at 1 Hz. Your browser tab is executing roughly 3 billion operations per second. The distance between those two numbers is the story of the next 80 years.


What Came Next

Zuse's Z1 ran at 1 Hz in a Berlin living room. Meanwhile, at a Victorian country house in Buckinghamshire, a young British mathematician named Alan Turing was racing against a very different kind of deadline. The Wehrmacht encrypted every convoy route, every battle order, every U-boat position with a machine called Enigma, and breaking it required searching thousands of rotor configurations before the keys changed at midnight. Turing's answer, the Bombe, would show that a machine could not only compute but solve under time pressure, at scale, with lives depending on it. That story is next: The Thinking Machine Chronicles #0004: The Machine That Won a War.


References

  1. Zuse, K. (1993). The Computer: My Life. Springer-Verlag. Autobiography.
  2. Rojas, R. (1997). "Konrad Zuse's Legacy: The Architecture of the Z1 and Z3." IEEE Annals of the History of Computing, 19(2), 5–16.
  3. Rojas, R. (1998). "How to Make Zuse's Z3 a Universal Computer." IEEE Annals of the History of Computing, 20(3), 51–54.
  4. Copeland, B.J. (ed.) (2006). Colossus: The Secrets of Bletchley Park's Codebreaking Computers. Oxford University Press.
  5. Ceruzzi, P.E. (2003). A History of Modern Computing (2nd ed.). MIT Press.