THE MOBIUS FUNCTION plus/minus/zero, and an inversion
μ(n) is a three-valued fingerprint of a number: 0 if a square divides n, else ±1 by whether n has an even or odd number of distinct primes. Tiny, but it powers Möbius inversion — recovering a function from its divisor-sums — the backbone of sieves and multiplicative number theory. And Euler had its values 84 years before Möbius.
THE TECHNIQUE square-free sign, then invert a divisor-sum
Factor n: if any prime appears squared, μ(n) = 0; otherwise μ(n) = (−1)k for k distinct primes. The magic is inversion: if g(n) = Σd|n f(d), then f(n) = Σd|n μ(d) g(n/d). Below: μ over a range, and φ recovered from n by inversion. live demo
HISTORY & CREDIT Euler had the values first
“Möbius discovered the Möbius function” — the function’s values are hisEuler’s (1748); Möbius (1832) studied series inversion. cited
1748 · Leonhard Euler — in the Introductio, the reciprocal of the zeta series ∏(1−p−s) = Σ μ(n)/ns has exactly these coefficients. The values are his. 1801 · Gauss (Disquisitiones, art. 81) uses Σ primitive roots ≡ μ(p−1) — 31 years before Möbius (who was literally Gauss’s astronomy student). 1832 · August Möbius publishes the inversion formula — in a paper on inverting series, an analysis result; the number-theory reading came later. the reach · Möbius inversion underlies the sieve (dart 017), counting with inclusion-exclusion, and the totient (dart 108).
A one-line function that turns divisor-sums inside out — older than its name by nearly a century. Euler 1748 / Möbius 1832
RECOMMEND FOR I-13 factor, sign, and a divisor-sum
Square-freeness and the sign are integer arithmetic — and the inversion recovers the totient exactly:
$ i13 run mobius.i13 # mu values + Mobius inversion
mu(1)=1 mu(30)=-1 mu(12)=0 phi(12) = sum mu(d)(12/d) = 4
Recommend:nothing new — factor n by trial division, flag a square (→ 0), else count distinct primes for the sign (verified μ(1)=1, μ(30)=−1, μ(12)=0). The inversionφ(n) = Σd|n μ(d)(n/d) is a divisor loop of integer multiply/add (verified φ(12) = 4). It ties the sieve (017) and Euler’s totient (108). Note: μ is the corpus’s cleanest three-valued object — +1 / 0 / −1, exact f64 integers — and inversion is the number-theory analogue of undoing a running sum.