August 27, 2024

P34 - Calculate Euler’s totient function ϕ ( m ) ϕ(m).

Euler’s so-called totient function ϕ(m)ϕ(m) is defined as the number of positive integers r(1<=r<=m)r(1<=r<=m) that are coprime to mm.

scala

scala> 10.totient
res0: Int = 4
Be first to comment
Leave a reply