This site is supported by donations to The OEIS Foundation.

# Characteristic function of squarefree numbers

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

$q(n)\,\equiv \,\chi _{\{squarefree\}}(n)=|\mu (n)|,\,$ where $\mu (n)\,$ (mu(n)) is the Möbius function. (When $n\,$ is a squarefree number we have $\mu (n)\,=\,\pm 1\,$ , otherwise when $n\,$ is a squareful number we have $\mu (n)\,=\,0\,$ .)

The quadratfrei function is also given by

${\rm {q}}(n)\,=\,[\Omega (n)=\omega (n)],\ n\,\geq \,1,\,$ where $\Omega (n)\,$ is the number of prime factors of n (with multiplicity), $\omega (n)\,$ is the number of distinct prime factors of n and where $[\cdot ]\,$ is the Iverson bracket. Also

${\rm {q}}(n)\,=\,[n={\rm {rad}}(n)],\ n\,\geq \,1,\,$ where ${\rm {rad}}(n)\,$ is the radical or squarefree kernel of $n\,$ .

## Related arithmetic functions

### Characteristic function of nonsquarefree numbers

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

${\bar {q}}(n)\,\equiv \,\chi _{\{nonsquarefree\}}(n)\,=\,[\Omega (n)\,\neq \,\omega (n)],\ n\,\geq \,1,\,$ where $[\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 $q(n)\,=\,|\mu (n)|\,$ is the quadratfrei function (characteristic function of squarefree numbers) and $\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 $p_{n}\,$ is the $n\,$ th prime number, and $\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 $[\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

$q(n)\,\equiv \,\chi _{\{squarefree\}}(n)\,=\,[\Omega (n)\,=\,\omega (n)],\ n\,\geq \,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, ...}

${\bar {q}}(n)\,\equiv \,1\,-\,q(n)\,\equiv \,\chi _{\{nonsquarefree\}}(n)\,=\,[\Omega (n)\,\neq \,\omega (n)],\ n\,\geq \,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, ...}