Ada Lovelace: What Did the First Computer Program Do?

A portion of Ada Lovelace's original Note G algorithm

In 1843, Augusta Ada King, Countess of Lovelace — known today as Ada Lovelace — published a set of notes on Charles Babbage’s proposed Analytical Engine. Those notes, appended to her translation of an Italian article about the machine, contained what is widely recognized as the first computer program: an algorithm for computing Bernoulli numbers.

The mythology around Lovelace often focuses on her as a symbol — the first programmer, a woman in a man’s field, a visionary ahead of her time. The mythology is warranted but incomplete. What she actually wrote, and what it demonstrated about computing, is more interesting than the legend.

The Machine That Did Not Exist

The Analytical Engine was never built. Babbage designed it in extensive detail — mechanical drawings, operation cards, memory architecture — but construction was never completed. This means Lovelace wrote software for hardware that existed only on paper.

This is important because it means her algorithm could not be tested empirically. She had to reason about the machine’s behavior entirely through formal analysis. This is the equivalent of writing a program for a CPU that has never been fabricated, using a specification document and pure logic. The cognitive demands are substantial.

The Analytical Engine, as Babbage designed it, had the essential components of a modern computer: a “store” (memory) for holding numbers, a “mill” (processor) for performing arithmetic operations, input via punched cards (borrowed from Jacquard looms), and the ability to branch and loop based on conditions. It was, conceptually, a general-purpose programmable computer — roughly a century before Turing formalized the concept.

What the Program Computed

Lovelace’s algorithm computed Bernoulli numbers — a sequence of rational numbers that appear throughout mathematics, particularly in number theory, analysis, and the computation of sums of powers. The first few Bernoulli numbers are: B₀ = 1, B₁ = -1/2, B₂ = 1/6, B₃ = 0, B₄ = -1/30, and so on.

The algorithm was published in “Note G” of her notes — the seventh and most extensive of her annotations. It described, step by step, how the Analytical Engine would compute the eighth Bernoulli number (B₈) using a recursive formula.

The algorithm was laid out in a table format that specified, for each step: which operation cards to use, which variables to read from the store, which arithmetic operation to perform, and where to write the result. This tabular format is recognizable to any modern programmer as a kind of assembly language listing.

What Made It Significant

Loops. The algorithm included what Lovelace described as “backing” — returning to a previous set of operation cards and executing them again with different values. This is iteration. She explicitly noted that the same set of cards could be reused for multiple cycles, a concept fundamental to every programming language.

Variables. The algorithm tracked intermediate results stored in the Engine’s columns, reusing and updating them across steps. Lovelace’s notation carefully distinguished between the initial value of a variable, its current value, and the value it would hold after an operation — an early form of variable state management.

Generalization. In her notes, Lovelace observed that the Analytical Engine could manipulate symbols of any kind, not just numbers. She wrote that the Engine “might act upon other things besides number, were objects found whose mutual fundamental relations could be expressed by those of the abstract science of operations.” This insight — that a computing machine could process any formally defined information, not just arithmetic — anticipated the concept of general-purpose computation by a century.

The Controversy

There is ongoing historical debate about how much of the algorithm was Lovelace’s original work versus Babbage’s. The two corresponded extensively, and Babbage clearly influenced the work. Some historians argue that Babbage provided the core mathematical approach and Lovelace “merely” translated it into the Engine’s notation.

This debate, while historically interesting, misses the point. Even if Babbage provided the mathematical formula, the act of translating that formula into a step-by-step algorithm executable by a machine — debugging the logic, managing the variables, handling the iteration — is programming. It is the same skill a modern developer uses when implementing a mathematical specification in code. The math and the code are different artifacts requiring different skills.

What Modern Developers Can Learn

Programming predates computers. Lovelace wrote her algorithm for a machine that did not exist, proving that the intellectual discipline of programming is independent of the hardware. We sometimes treat programming as inseparable from the tools — the IDE, the compiler, the runtime — but the core skill is formal reasoning about sequences of operations.

Documentation matters. Lovelace’s notes are not just an algorithm — they are an explanation. She described what the algorithm does, why each step is necessary, and what the broader implications are. The program is embedded in context. Modern developers who write code without documentation could learn from an 1843 example.

Vision matters. Lovelace’s observation that the Engine could process symbols beyond numbers — her vision of general-purpose computation — was not necessary for the immediate task of computing Bernoulli numbers. She looked beyond the specific problem to the general capability. This is the difference between a programmer and a computer scientist.

The Bottom Line

The first computer program computed Bernoulli numbers on a machine that was never built. It demonstrated iteration, variable management, and formal algorithmic reasoning. Its author saw further than the immediate application to envision general-purpose computation. The program itself is less famous than the programmer, but it deserves careful reading. It is a remarkable piece of work.