Skip to main content

Möbius function

For any positive integer nn, the Möbius function μ(n)\mu(n) is defined as

μ(n)=-1ifnisasquare-freepositiveintegerwithanoddnumberofprimefactors0ifnhasasquaredprimefactor1ifnisasquare-freepositiveintegerwithanevennumberofprimefactors

Syntax

mu_moebius(Integer)

Description

Given an integer nn, returns μ(n)\mu(n) as defined above.

arithmetic.mu_moebius.calc.png