Skip to main content

Phi Euler

Euler's totient function counts the positive integers up to a given integer n that are relatively prime to nn. Formally, it can be defined as the number of integers k in the range 1kn for which gcd(n,k)=1. Euler's product formula states

φ(n)=np|n1-1p

For a prime number p and for an integer kk, this expression reduces to

φ(pk)=pk1-1p

Syntax

phi_euler(Integer)

Description

Given an integer nn, returns φ(n).

arithmetic.phi_euler.calc.png