Bernoulli numbers
The Bernoulli numbers are a sequence of rational numbers that surface throughout mathematics — in power sums, series expansions, and number theory. In computing they are famous for a different reason: computing them is the subject of Ada Lovelace's 1843 algorithm for the Analytical Engine, the first program published for a machine.
The sequence
First studied by Jakob Bernoulli around 1713 in his work on sums of powers, the sequence begins:
| B₀ | B₁ | B₂ | B₃ | B₄ | B₅ | B₆ | B₇ | B₈ |
|---|---|---|---|---|---|---|---|---|
| 1 | −1/2 | 1/6 | 0 | −1/30 | 0 | 1/42 | 0 | −1/30 |
The odd-indexed numbers past B₁ are all zero; the even ones alternate sign and grow explosively. They appear wherever powers accumulate — the sum 1ᵏ + 2ᵏ + … + nᵏ, the series for the tangent, and deep results like the Riemann zeta function at negative integers: ζ(−n) = −Bₙ₊₁/(n+1).
The first program
When Lovelace translated Menabrea's paper on Babbage's engine, she needed a computation that would show the machine's real power — not a fixed formula but a process with repetition and accumulation. Bernoulli numbers fit perfectly: each one can be derived from the ones before it, so the engine would loop, feeding its own intermediate results back through the mill.
Note G presented the method as a step-by-step table of operations — variables in, intermediate columns, and the cascade of dependent values — essentially a trace of execution written before any machine existed to run it. In modern terms she wrote a loop with a recurrence inside it, verified the register flow by hand, and shipped the listing in a journal.
Why they mattered
- They needed the whole machine — simple formulas would have wasted the demo; the recurrence demanded storage, sequencing, and reuse of results.
- The program was traceable — her operation table let a reader step through the computation, which is why historians can still execute Note G today and why it serves as evidence of what the engine could do.
- They outlived the machine — the engine was never built, but Bernoulli-number recurrences remain a standard test program; emulations of Note G's algorithm run correctly on modern reconstructions of Babbage's design.