Note G
Note G is a computer algorithm which many claim was written by Ada Lovelace that was designed to calculate Bernoulli numbers using the hypothetical analytical engine.
The algorithm was the last note in a series labelled "A" to "G", which were employed as visual aids to accompany Lovelace's English translation of Luigi Menabrea's 1842 French transcription of Charles Babbage's only lecture on the analytical engine. Her translation, along with her substantial notes on the possibilities of the analytical engine, were published in 1843.
In Babbage's 1864 memoir he discusses the creation of the various notes with Lovelace, including note "G", which makes it clear he composed that particular note, with Lovelace spotting a bug for him:
We discussed together the various illustrations that might be introduced: I suggested several, but the selection was entirely her own. So also was the algebraic working out of the different problems, except, indeed, that relating to the numbers of Bernouilli, which I had offered to do to save Lady Lovelace the trouble. This she sent back to me for an amendment, having detected a grave mistake which I had made in the process.
— Charles Babbage, Passages from the Life of a Philosopher (1864)
Historians like Allan G. Bromley have noted several dozen sample programs prepared by Babbage between 1837 and 1840 (all substantially predating the illustrative notes), however, in popular culture, Note G is generally considered to be the first algorithm specifically for a computer, and Lovelace is considered as the first computer programmer.
The program described in Note G was not tested in Babbage's or Lovelace's lifetime, as the analytical engine was never built. In the modern era, the algorithm has been tested using modern computing methods and revealed to have a software bug in it due to two variables being swapped in a division operation.