This site is supported by donations to The OEIS Foundation.

# Characteristic function of squarefree numbers

The quadratfrei function $\scriptstyle q(n) \,$ is given by

$q(n) \,\equiv\, \chi_{\{squarefree\}}(n) = |\mu(n)|, \,$

where $\scriptstyle \mu(n) \,$ (mu(n)) is the Möbius function. (When $\scriptstyle n \,$ is a squarefree number we have $\scriptstyle \mu(n) \,=\, \pm 1 \,$, otherwise when $\scriptstyle n \,$ is a squareful number we have $\scriptstyle \mu(n) \,=\, 0 \,$.)

The quadratfrei function is also given by

${\rm q}(n) \,=\, [\Omega(n) = \omega(n)],\ n \,\ge\, 1, \,$

where $\scriptstyle \Omega(n) \,$ is the number of prime factors of n (with multiplicity), $\scriptstyle \omega(n) \,$ is the number of distinct prime factors of n and where $\scriptstyle [\cdot] \,$ is the Iverson bracket. Also

${\rm q}(n) \,=\, [n = {\rm rad}(n)],\ n \,\ge\, 1, \,$

where $\scriptstyle {\rm rad}(n) \,$ is the radical or squarefree kernel of $\scriptstyle n \,$.

## Related arithmetic functions

### Characteristic function of nonsquarefree numbers

The characteristic function of nonsquarefree numbers, i.e. the complement $\scriptstyle \bar{q}(n) \,=\, 1 \,-\, q(n) \,$ of the quadratfrei function $\scriptstyle q(n) \,$ is given by

$\bar{q}(n) \,\equiv\, \chi_{\{nonsquarefree\}}(n) \,=\, [\Omega(n) \,\neq\, \omega(n)],\ n \,\ge\, 1, \,$

where $\scriptstyle [\cdot] \,$ is the Iverson bracket.

The summatory quadratfrei function is defined as

$Q(n) \equiv \sum_{i=1}^{n} q(n) = \sum_{i=1}^{n} |\mu(n)| \,$

where $\scriptstyle q(n) \,=\, |\mu(n)| \,$ is the quadratfrei function (characteristic function of squarefree numbers) and $\scriptstyle \mu(n) \,$ is the Moebius function.

The asymptotic density of squarefree numbers corresponds to the probability that 2 randomly chosen integers are coprime

$\lim_{n \to \infty} \frac{Q(n)}{n} = \prod_{n=1}^{\infty} \bigg(1 - \frac{1}{{p_n}^2}\bigg) = \frac{1}{\zeta(2)} = \frac{6}{\pi^2}, \,$

where $\scriptstyle p_n \,$ is the $\scriptstyle n \,$th prime number, and $\scriptstyle \zeta(s) \,$ is the Riemann zeta function.

The asymptotic density of squarefree numbers with an odd number of prime factors is equal to the the asymptotic density of squarefree numbers with an even number of prime factors, i.e.

$\lim_{n \to \infty} \frac{\sum_{i=1}^{n} [\mu(i) = -1]}{n} = \lim_{n \to \infty} \frac{\sum_{i=1}^{n} [\mu(i) = +1]}{n} = \frac{1}{2 \zeta(2)} = \frac{3}{\pi^2}, \,$

where $\scriptstyle [\cdot] \,$ is the Iverson bracket.

The graph of the Mertens function (the Mertens function being the summatory Moebius function) seems to indicate an average negative bias for the Mertens function, which would mean that there is a bias (eerily similar to the Chebyshev bias) in favor of the squarefree numbers with an odd number of prime factors over the squarefree numbers with an even number of prime factors. This existence or not of such a bias, if small enough, would have no effect on the asymptotic behavior.

## Sequences

$\scriptstyle q(n) \,\equiv\, \chi_{\{squarefree\}}(n) \,=\, [\Omega(n) \,=\, \omega(n)],\ n \,\ge\, 1, \,$ (Cf. A008966) gives the sequence

{1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, ...}

$\scriptstyle \bar{q}(n) \,\equiv\, 1 \,-\, q(n) \,\equiv\, \chi_{\{nonsquarefree\}}(n) \,=\, [\Omega(n) \,\neq\, \omega(n)],\ n \,\ge\, 1, \,$ (Cf. A107078) gives the sequence

{0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, ...}