Mertens’ Conjecture
January 24, 2020
Dr Holly Krieger discussed Mertens’ Conjecture on Numberphile yesterday:
Mertens’ Conjecture: The absolute value of the Mertens function M(n), computed as the sum for k from 1 to n of the Moebius function μ(k), is less than the square root of n. The Moebius function μ(n) is (-1)^k, where k is the number of prime factors of n, but 0 if n has any repeated prime factors.
The conjecture has been proved false, though no counter-examples are known. You can read more about Mertens’ Conjecture at MathWorld or Wikipedia.
Your task is to write a program to compute Mertens’ function M(n) and use it to explore some of the sequences at OEIS. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
I’d have thought using some sort of sieve would be better for this.
For example:
Here’s a solution in Python, seemingly requiring excessive computation relative to @matthew’s sieve approach above.
Output:
Similar to finding primes with the sieve of Eratosthenes compared with checking all numbers with trial division.