Mobius Function Calculator mu(n) and Mertens M(N)

Mobius function mu(n) calculator: +1, -1, 0 values, Mertens function M(N), Mobius inversion formula, 6/pi^2 squarefree density and number factorization.

Calculation parameters
Was this calculator useful?

The Mobius function

The Mobius function mu(n), introduced by August Ferdinand Mobius in 1832, is one of the most important functions in arithmetic number theory. Defined for positive integers as:

  • mu(1) = 1 (base case)
  • mu(n) = 0 if n is divisible by a square p^2 (not squarefree)
  • mu(n) = (-1)^k if n is product of k distinct primes (squarefree)

Values: mu(1)=1, mu(2)=-1, mu(3)=-1, mu(4)=0, mu(5)=-1, mu(6)=1, mu(7)=-1, mu(8)=0, mu(9)=0, mu(10)=1, mu(11)=-1, mu(12)=0, mu(30)=1 (30=2*3*5), mu(42)=-1 (42=2*3*7).

Multiplicative property

mu is multiplicative: if gcd(m, n) = 1, then mu(mn) = mu(m) * mu(n). Makes mu fundamental in analytic number theory. Also, for every n > 1:

sum_{d | n} mu(d) = 0

This relation, with convention sum_{d | 1} mu(d) = 1, is the basis of Mobius inversion.

Mobius inversion formula

If two arithmetic functions f, g satisfy:

g(n) = sum_{d | n} f(d) for every positive n

then:

f(n) = sum_{d | n} mu(d) * g(n/d)

Notable applications: (

  • Euler's totient phi(n) = sum_{d | n} d * mu(n/d); (
  • number of irreducible polynomials over F_p of degree n = (1/n) sum_{d | n} mu(d) * p^(n/d) (Gauss); (
  • Dirichlet series and L-functions

Mertens function

Mertens function M(N) is the partial sum:

M(N) = sum_{k=1}^{N} mu(k)

Values: M(1)=1, M(2)=0, M(10)=-1, M(100)=1, M(1000)=2, M(10000)=-23, M(100000)=-48. Oscillates pseudorandomly around 0.

Mertens conjecture (1897)

Franz Mertens conjectured |M(N)| = sqrt(N). No explicit counterexample known, but first is between 10^16 and 10^40. RH implies only |M(N)| = O(N^(1/2+eps)) for every eps > 0.

Five calculator modes

  1. Single mu(n): value with factorization and classification.
  2. Sequence: list mu(1)..mu(N) with statistics.
  3. Mertens function: M(N) via sieve.
  4. Inversion: applied example to totient phi(n) = sum d mu(n/d).
  5. Squarefree density: Q(N) and convergence to 6/pi^2.

Squarefree number density

A number n is squarefree if no square p^2 > 1 divides it, equivalent to mu(n) != 0. Asymptotic density of squarefree in [1, N]:

lim_{N -> inf} Q(N) / N = 1 / zeta(2) = 6 / pi^2 ~ 0.6079271018540...

Proof: P(n squarefree) = Prod_{p prime} (1 - 1/p^2) = 1/zeta(2) = 6/pi^2. So about 60.79% of integers are squarefree.

Dirichlet series and zeta

Mu's Dirichlet series is strictly linked to zeta:

sum_{n=1}^{inf} mu(n) / n^s = 1 / zeta(s), for Re(s) > 1

Makes mu the 'multiplicative dual' of 1 (constant 1 has zeta(s) series). Basis for prime number theorem proof via L-functions and link between prime distribution and zeta zeros.

Applications

  • Analytic number theory: prime number theorem proof, von Mangoldt explicit formulas.
  • Combinatorics: counting objects with constraints (generalized inclusion-exclusion).
  • Finite group theory: counting irreducible representations, subgroups by order.
  • Cryptography: prime generation, probabilistic primality tests.
  • Theoretical CS: sieve algorithms for factorization and primality.
  • Statistical physics: Mobius inversion in lattice partitions and free energy calculations.

History of the Möbius function

The function is named after the German mathematician and astronomer August Ferdinand Möbius, who introduced it in 1832 while studying series and inversion problems. Möbius is famous above all for the Möbius strip, the one-sided surface that bears his name, but his contributions to number theory were equally profound. The function μ(n) arose from the need to invert relations between arithmetic functions: given the value of a sum over divisors, how do you recover the original function? The answer is the celebrated Möbius inversion formula. Although some ideas were already present in Euler and Gauss, it was Möbius who formalised the function and showed its power. Today it is a fundamental tool of analytic number theory, with deep links to the prime numbers and the zeta function.

The Möbius function and the Riemann hypothesis

One of the most fascinating aspects of the Möbius function is its direct link with the Riemann hypothesis, the most famous unsolved problem in mathematics. The Mertens function M(N), the cumulative sum of the values of μ(k), grows apparently chaotically, oscillating around zero. It can be shown that the Riemann hypothesis is equivalent to the statement that M(N) = O(N^(1/2+ε)) for every ε > 0: that is, the Mertens function never grows much faster than the square root of N. This connects an apparent arithmetical curiosity to the behaviour of the zeros of the Riemann zeta function. Mertens' original 1897 conjecture, |M(N)| < √N, stronger, was instead disproved in 1985 by Odlyzko and te Riele, without, however, exhibiting an explicit counterexample.

Updated July 2026

Frequently Asked Questions

What is the Möbius function?

The Möbius function μ(n) is an arithmetic function that equals 1 if n=1, 0 if n is divisible by the square of a prime, and (−1)^k if n is the product of k distinct primes. For example μ(30)=μ(2·3·5)=−1 (three distinct primes), while μ(12)=0 because 12=2²·3 contains a square. It is fundamental in number theory, especially for the inversion formula that bears its name.

What is the Möbius inversion formula?

It is the result that lets sums over divisors be inverted. If g(n) = Σ_{d|n} f(d), that is g is the sum of f over all divisors of n, then f can be recovered with f(n) = Σ_{d|n} μ(d)·g(n/d). It is a very powerful tool in number theory, used for example to derive Euler's totient function, the von Mangoldt function and many other arithmetic relations.

What are squarefree numbers?

A number is squarefree if it is not divisible by the square of any prime, that is in its factorisation each prime appears at most once. For example 30=2·3·5 is squarefree, while 12=2²·3 is not. The Möbius function is non-zero exactly on the squarefree numbers. Their asymptotic density is 6/π² ≈ 60.79%, a remarkable result linked to the zeta function.

What is the Mertens function?

The Mertens function M(N) is the cumulative sum of the values of the Möbius function: M(N) = μ(1)+μ(2)+…+μ(N). Since μ takes the values +1, −1 and 0 apparently at random, M(N) oscillates around zero pseudorandomly. Its asymptotic behaviour is deeply linked to the prime numbers and the Riemann hypothesis, one of the great unsolved problems in mathematics.

What was the Mertens conjecture?

In 1897 Franz Mertens conjectured that |M(N)| < √N for every N, that is that the Mertens function always stayed bounded by the square root of N. The conjecture was verified numerically for enormous values, but in 1985 Andrew Odlyzko and Herman te Riele disproved it, showing that there exist N for which the inequality fails, without, however, exhibiting an explicit counterexample, which remains of astronomical size.

What is the link with the Riemann hypothesis?

The Riemann hypothesis is equivalent to the statement that the Mertens function grows slowly, precisely M(N) = O(N^(1/2+ε)) for every ε > 0. In other words, if one could prove that M(N) never much exceeds the root of N, one would prove the Riemann hypothesis. This connects the apparently elementary Möbius function to one of the deepest mysteries about the prime numbers.

How does the Möbius function relate to zeta?

The Dirichlet series of the Möbius function is the reciprocal of the Riemann zeta function: Σ μ(n)/nˢ = 1/ζ(s). This elegant relation underlies many results of analytic number theory. In particular, setting s=2, one obtains that the density of squarefree numbers is 1/ζ(2) = 6/π². The Möbius function is thus intimately connected to the multiplicative structure of the integers.

Who introduced the Möbius function?

It was introduced by the German mathematician and astronomer August Ferdinand Möbius in 1832, also famous for the Möbius strip. He studied it in the context of series inversion problems. Some ideas were already in Euler and Gauss, but Möbius gave the definitive formulation. Today it is a central tool of analytic number theory, with applications from the prime numbers to combinatorics and cryptography.

Comments (0)

No comments yet. Be the first!