Case Study: Verifying an Efficient Algorithm to Compute Bernoulli Numbers
- 👤 Speaker: Manuel Eberl (Universität Innsbruck)
- 📅 Date & Time: Thursday 12 June 2025, 11:45 - 12:45
- 📍 Venue: Seminar Room 1, Newton Institute
Abstract
The Bernoulli numbers B(k) are a sequence of rational numbers that is ubiquitous in mathematics, but difficult to compute efficiently (compared to e.g. approximating π. In 2008, Harvey gave the currently fastest known practical way for computing them: his algorithm computes B(k) mod p in time O(p log) p). By doing this for O(k) many small primes p in parallel and then combining the results with the Chinese Remainder Theorem, one recovers the value of B(k) as a rational number in O(k² log(2+o(1)) k) time. One advantage of this approach is that the expensive part of the algorithm is highly parallelisable and has very low memory requirements. This algorithm still holds the world record with its computation of B(10^8). We give a fully verified efficient LLVM implementation of this algorithm. This was achieved by formalising the necessary mathematical background theory in Isabelle/HOL, proving an abstract version of the algorithm correct, and refining this abstract version down to LLVM using Lammich’s Isabelle-LLVM framework, including many low-level optimisations. The performance of the resulting LLVM code is comparable with Harvey’s original unverified and hand-optimised C++ implementation.
Series This talk is part of the Isaac Newton Institute Seminar Series series.
Included in Lists
- All CMS events
- bld31
- dh539
- Featured lists
- INI info aggregator
- Isaac Newton Institute Seminar Series
- School of Physical Sciences
- Seminar Room 1, Newton Institute
Note: Ex-directory lists are not shown.
![[Talks.cam]](/static/images/talkslogosmall.gif)

Manuel Eberl (Universität Innsbruck)
Thursday 12 June 2025, 11:45-12:45