phi {primes}R Documentation

Euler's Totient Function

Description

Compute Euler's Totient Function (\phi(n)). Provides the count of k integers that are coprime with n such that 1 \le k \le n and gcd(n,k) = 1.

Usage

phi(n)

Arguments

n

an integer vector.

Value

An integer vector.

Author(s)

Paul Egeler, MS

References

"Euler's totient function" (2020) Wikipedia. https://en.wikipedia.org/wiki/Euler%27s_totient_function (Accessed 21 Aug 2020).

See Also

gcd, coprime, prime_factors

Examples

phi(12)
## [1] 4

phi(c(9, 10, 142))
## [1]  6  4 70


[Package primes version 1.6.0 Index]