A rare 175 year-old book containing the world's first computer algorithm by Ada Lovelace – mathematician and daughter of Lord Byron – has been sold at auction in England for £95,000 (US$125,000).

Only five copies of Sketch of the Analytical Engine invented by Charles Babbage Esq by L.F. Menabrea of Turin, officer of the Military Engineers, with notes by the translator were known to exist (Harvard University has two of them). That was until this one was found in a box of books owned by a couple in the Cotswolds.

Auctioneer Philip Allwood described the lot as "the first separate edition of arguably the most important paper in the history of digital computing before modern times" and "an extremely rare piece."

The book began as a translation from an account of Charles Babbage's Analytical Engine by Luigi Menabrea (later to become the Italian Prime Minister) but Lovelace couldn't help but add many pages of her own notes during the year-long project. Among these additions were her revolutionary observations that Babbage's machine could have applications beyond pure calculation – in a way, foreseeing the the future of computing – and of course, her historic algorithm.

In Note G of the text, Lovelace describes an algorithm for the Analytical Engine to compute Bernoulli numbers. This is widely regarded as the first published algorithm written for a computer, and it's for this reason that Ada Lovelace is often cited as our first ever computer programmer.

Auction house Moore, Allen & Innocent knew it had something special on its hands and gave the volume an estimated value of £40,000 to £60,000 ($52,000 - $79,000) but expected far more. In the end, the hammer fell on the final bid of a £95,000 from a Cotswolds book dealer acting on behalf of an anonymous buyer.

While the book was published in 1843, it wasn't until 1848 that Lovelace's identity as the translator was revealed, four years before her death from cancer at the age of 36.

The Cirencester copy was signed Lady Lovelace on the title page, under the line "with notes by the translator" while handwritten notes on the flyleaf were attributed to Dr William King (not to be confused with her husband William King-Noel), a friend and adviser of Lady Lovelace, who is presumed to be the original owner of the book.

In a letter to scientist Michael Farrady, Babbage described Lovelace as "that enchantress who has thrown her magical spell around the most abstract of sciences and has grasped it with a force which few masculine intellects (in our country at least) could have exerted over it."

View gallery - 8 images