# The Enchantress of numbers

**Computer Science**Level 4

Lovelace was deeply interested in Charles Babbage's Analytic Engine and proposed a program to compute the Bernoulli numbers using punch cards. Her original note on the program describes a clever way of computing these numbers. Can you recreate the first computer program or make your own so as to efficiently find these numbers?

The \(n\)th Bernoulli number \(B_{n}\) is given by the double sum

\[B_n=\sum _{ k=0 }^n{ \frac{1}{ k+1 }}\sum _{ r=0 }^k(-1)^r\dbinom{k}{r}r^n\]

If \[S_{500}=\sum _{ n=0 }^{ 500 }{ { B }_{ n } } \] can be represented as \(-\frac{a}{b}\) for two co-prime integers \(a\) and \(b\). Find the last five digits of \(a+b\)

**Details and assumptions**

- \(B_{n}\) is the
**"original"**Bernoulli number where \(B_{1} = \frac{1}{2}\) not \(\frac{-1}{2}\).

**Explicit example**

\[S_{5}=\sum _{ n=0 }^{ 5 }{ { B }_{ n } } = \frac{49}{30} \]