Bernoulli and Ada sitting in a tree…
Ada Lovelace is credited with writing the very first computer program. This program was for Babbage’s Analytical Engine and calculated Bernoulli numbers.
Bernoulli numbers have the following mathematical definition:
It’s just a sequence of numbers that looks something more like this:
They’ve been found to be important since they keep coming up over and over in mathematics, which makes them really interesting from a number theory perspective. Also, note that all odd n after 1 has the value of 0.
The Bernoulli numbers appear in the Taylor series expansions of the tangent and hyperbolic tangent functions, in formulas for the sum of powers of the first positive integers, in the Euler–Maclaurin formula, and in expressions for certain values of the Riemann zeta function.
Well after Ada Lovelace wrote her ‘program’ to calculate Bernoulli numbers a language called Ada was created. Using the Akiyama–Tanigawa algorithm for second Bernoulli numbers I decided to write my very first Ada program.
You can see the result below fully commented with my frustrations and concerns along with what the code outputs (note that this is with Ada 2012, though most information I found on Ada was for Ada 95).