Transcription of the first operations of the Note G diagram, Sketch of the Analytical Engine (1843)
Excerpt. The complete work is at the source.
In 1843 Ada Lovelace translated Luigi Menabrea's account of Babbage's Analytical Engine and attached notes longer than the article. Note G ends in a diagram: a table that walks the Engine, operation by operation, through the calculation of the Bernoulli numbers. Each row names an operation, the variables it reads, the variable that receives the result, and what that result means. The superscript on a variable counts how many times it has been assigned; the subscript says which register it is.
This is not a program in the modern sense; there was no machine to run it, and Babbage supplied the mathematics. What Lovelace supplied was the conversion of a formula into a sequence of steps a machine could follow, with state tracked in named, versioned variables. It reads today like an execution trace, and it is usually called the first published algorithm intended for a computer. Operation 4 carries a famous slip in the printed diagram. Bugs, it turns out, are older than computers.