# Möbius function (moebius_mu)

Moebius function: 0 if a square divides n, else 1 or -1 by the parity of its prime factors.

## How to write it

### moebius_mu(n)

**n**

A whole number. Takes a whole number.

## Examples

- $\displaystyle \operatorname{moebius\_mu}(30) = -1$

  `moebius_mu(30)`

  In the solver, `moebius_mu(30)` gives `-1`.

  [Open in the solver](https://hilberon.com/?q=moebius_mu%2830%29)

## Related functions

- [multinomial](https://hilberon.com/library/multinomial)

  Multinomial coefficient: the ways to split n items into groups of the given sizes.
- [modular_inverse](https://hilberon.com/library/modular_inverse)

  The inverse of a whole number modulo another.
- [multiplicative_order](https://hilberon.com/library/multiplicative_order)

  The least power of a number that is 1 modulo another.
- [lucas_l](https://hilberon.com/library/lucas_l)

  The n-th Lucas number.
- [next_prime](https://hilberon.com/library/next_prime)

  The least prime greater than a number.
- [jacobi_symbol](https://hilberon.com/library/jacobi_symbol)

  Jacobi symbol (a/n), for an odd positive n.

---
Source: https://hilberon.com/library/moebius_mu
