Totient Function - Maple Help

Home : Support : Online Help : Mathematics : Number Theory : Totient Function

NumberTheory

 Totient
 Euler's totient function

Calling Sequence

 Totient(n) phi(n) $\mathrm{\phi }\left(n\right)$ varphi(n) $\mathrm{\varphi }\left(n\right)$

Parameters

 n - positive integer

Description

 • The Totient function computes Euler's totient function.
 • Given a positive integer n, Totient(n) returns the number of positive integers coprime to n and not greater than n.
 • phi and varphi are aliases of Totient.
 • You can enter the commands phi and varphi using either the 1-D or 2-D calling sequence. For example, phi(8) is equivalent to $\mathrm{\phi }\left(8\right)$, and varphi(8) is equivalent to $\mathrm{\varphi }\left(8\right)$.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$
 > $\left[\mathrm{Totient}\left(1\right),\mathrm{\phi }\left(2\right),\mathrm{\varphi }\left(3\right)\right]$
 $\left[{1}{,}{1}{,}{2}\right]$ (1)

If two integers n and m are coprime, then Totient(n)*Totient(m) = Totient(m*n). That is, the totient function is multiplicative.

 > $\left[\mathrm{Totient}\left(44\right)\mathrm{Totient}\left(79\right),\mathrm{Totient}\left(44\cdot 79\right)\right]$
 $\left[{1560}{,}{1560}\right]$ (2)
 > $\mathrm{andmap}\left(i↦\mathrm{igcd}\left(i\left[1\right],i\left[2\right]\right)\ne 1\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{xor}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{\phi }\left(i\left[1\right]\cdot i\left[2\right]\right)=\mathrm{\phi }\left(i\left[1\right]\right)\cdot \mathrm{\phi }\left(i\left[2\right]\right),\left[\mathrm{seq}\left(\mathrm{seq}\left(\left[i,j\right],j=1..100\right),i=1..100\right)\right]\right)$
 ${\mathrm{true}}$ (3)

The totient of any prime p is equal to p-1.

 > $\left[\mathrm{Totient}\left(59\right),\mathrm{Totient}\left(101\right)\right]$
 $\left[{58}{,}{100}\right]$ (4)
 > $\mathrm{andmap}\left(i↦\mathrm{ithprime}\left(i\right)-1=\mathrm{\varphi }\left(\mathrm{ithprime}\left(i\right)\right),\left[\mathrm{seq}\left(1..100\right)\right]\right)$
 ${\mathrm{true}}$ (5)

The following command plots the values of Totient(n) for n from $2$ to $1000$.

 > $\mathrm{plots}:-\mathrm{pointplot}\left(\left[\mathrm{seq}\left(\left[n,\mathrm{Totient}\left(n\right)\right],n=2..1000\right)\right],\mathrm{labels}=\left["n",\phi \left(n\right)\right],\mathrm{color}="Niagara BlueGreen",\mathrm{symbol}=\mathrm{circle}\right)$

Compatibility

 • The NumberTheory[Totient] command was introduced in Maple 2016.