Möbius function (source code)

= Möbius function
{c}
{title2=$\mu(n)$}
{wiki}

The <Möbius function> assigns a cancellation weight to each <positive integer>:
$$
\mu(n)=\begin{cases}
1&n=1,\\
(-1)^r&n=p_1\cdots p_r\text{ with distinct primes }p_1,\ldots,p_r,\\
0&p^2\mid n\text{ for some prime }p.
\end{cases}
$$
Thus a <squarefree integer> contributes a sign determined by its number of distinct <prime factors>; a repeated <prime factor> makes the weight zero. This packages the alternating signs of <inclusion-exclusion> into an <arithmetic function>. https://darijgrinberg.gitlab.io/floor.pdf[Darij Grinberg, MIT 18.781 lecture notes, Definition 2.1.2]{ref}

For example, $\mu(2)=\mu(3)=-1$, $\mu(6)=1$, and $\mu(30)=(-1)^3=-1$, since $30=2\cdot3\cdot5$. In contrast, $\mu(4)=\mu(12)=\mu(60)=0$: all three have the square of the <prime number> $2$ as a <divisor>. On <prime powers>, $\mu(p)=-1$ and $\mu(p^a)=0$ for $a\geq2$.

The <Möbius function> is a <multiplicative function>: for <coprime integers>, their <prime factors> are disjoint, so either a squared <prime factor> forces both sides of $\mu(mn)=\mu(m)\mu(n)$ to vanish, or the counts of distinct <prime factors> add and their signs multiply. It is not a <completely multiplicative function>, since $\mu(4)=0\ne1=\mu(2)^2$. Its <Möbius divisor-sum identity> makes it the inverse of the <constant-one arithmetic function> under <Dirichlet convolution>: $\mu*\mathbf1=\varepsilon$, the <Identity for Dirichlet convolution>. This is why the small set of weights $-1,0,1$ can undo an entire <divisor sum>.