# Euler's totient function (totient)

Euler's totient: how many whole numbers up to n are coprime to n.

## How to write it

### totient(n)

**n**

A whole number. Takes a whole number.

## Examples

- $\displaystyle \operatorname{totient}(10) = 4$

  `totient(10)`

  In the solver, `totient(10)` gives `4`.

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

## Related functions

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

  The n-th Bell number: how many ways to split n items into groups.
- [subfactorial](https://hilberon.com/library/subfactorial)

  Subfactorial: how many ways to reorder n items so none stays in place.
- [bernoulli_b](https://hilberon.com/library/bernoulli_b)

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

  Stirling number of the second kind: the ways to split n items into k groups.
- [carmichael_lambda](https://hilberon.com/library/carmichael_lambda)

  Carmichael function: the least power that takes every number coprime to n to 1 modulo n.
- [stirling_s1](https://hilberon.com/library/stirling_s1)

  Stirling number of the first kind, with sign.

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