Project Euler Problem 541

The nth harmonic number Hn is defined as the sum of the multiplicative inverses of the first n positive integers, and ca

Project Euler Problem 541

Solution

Answer: 4580726482872451

I derived and independently verified the computation using a $p$-adic lifting approach for harmonic numbers, together with a direct implementation that reproduces the given checks:

  • $M(3)=68$
  • $M(7)=719102$

The computation for $p=137$ yields:

Answer: 4580726482872451