Sum of the kth powers (Faulhaber's formula)
ProvedFamousTheorems.sum_range_powFaulhaber's formula for sums of powers.
For all ,
where are the Bernoulli numbers.
So is always a polynomial in of degree with leading coefficient , and the formula names every coefficient at once. For it returns ; for , . Before Faulhaber each case was found separately; the Bernoulli numbers are precisely the universal constants that make one formula cover all .
Faulhaber computed the cases up to in 1631. Jacob Bernoulli found the general pattern and introduced the numbers now named after him in Ars Conjectandi (posthumous, 1713) — he remarked that with it he summed the tenth powers of the first thousand integers "in half a quarter of an hour". The same numbers reappear in the Euler–Maclaurin formula and in the values .
Formalization note. The sum runs over Finset.range n, i.e. , and everything is
over so that the division is exact. bernoulli is the convention with . The
result is Mathlib's sum_range_pow.
import Mathlib
namespace FamousTheorems
theorem sum_range_pow (n p : ℕ) :
(∑ k ∈ Finset.range n, (k : ℚ) ^ p) =
∑ i ∈ Finset.range (p + 1),
bernoulli i * ((p + 1).choose i) * (n : ℚ) ^ (p + 1 - i) / (p + 1) := by sorry
end FamousTheorems