# When is $\phi(n)=n$ true?

For what values of n is $\phi(n)=n$ true? Just looking at tables of values it seems that $\phi(n)=n$ is true only for $n=0,1$ but I cannot come up with how to prove this.

I realize that the value of $\phi(0)$ is not really well-defined (What is the Euler Totient of Zero?) but for the purpose of this question I'll assume it is.

• There is no reason even to define $\varphi(0)$. – André Nicolas Apr 30 '15 at 0:53
• @AndréNicolas Whether there is a reason or not, Wolfram MathWorld says it's defined: $\phi(0)=1$. – user26486 Apr 30 '15 at 15:32
• The opinion of Alpha is of interest, but more relevant are standard books. – André Nicolas Apr 30 '15 at 15:40
• @AndréNicolas and yet WolframAlpha itself defines $\phi(0)=0$. It seems Wolfram is being inconsistent. – user26486 Apr 30 '15 at 16:29
• For OP's question, what matters is the definition of $\varphi$ in the book/notes in which the question was asked. As to whether one should define $\varphi$ at $0$, the question really comes down to what do the standard books do? I believe that overwhelmingly they do not define $\varphi$ at $0$. However, that needs confirmation, which is not an easy task, since there are many elementary number theory texts, in many languages. – André Nicolas Apr 30 '15 at 16:47

First, $\varphi(n)$ is defined only for $n\ge 1$. Second, if $n=\prod\limits_{i=1}^r p_i^{r_i}$ for primes $p_1,\dots,p_r$, we have: $$\frac{\varphi(n)}n=\prod_{i=1}^r\Bigl(1-\frac1p_i\Bigr).$$ Thus, $\varphi(n)=n\iff\dfrac{\varphi(n)}n=1$ can be true if and only if $r=0$, i. e. $n=1$.

• Wolfram MathWorld says that by convention $\phi(0)=1$, so it's not only defined for $n\ge 1$. – user26486 Apr 30 '15 at 15:24
• That's pure convention. When I begun learning some number theory, it was defined for $n\ge 1$. – Bernard Apr 30 '15 at 15:26

From the definition of $\phi(n)$ is the number of positive integers not exceeding $n$, that are relatively prime to $n$. Further, for $n>1$, we have $\gcd(n,n) = n$. Hence, for $n > 1$, we have $\phi(n) < n$. Hence, $n$ can be only $0$ or $1$.

• $\phi(0)=1$ (see Wolfram MathWorld). – user26486 Apr 30 '15 at 15:33
• @user26486 This can be argued, and Wolfram Alpha saying so does not settle the issue. – Robert Soupe Jul 8 '15 at 1:35
• Oops, that says Mathworld, not Alpha. Note also that it says "the Wolfram Language defines EulerPhi[0] equal to 0 for consistency with its FactorInteger[0] command." – Robert Soupe Jul 8 '15 at 1:37
• A convention accepted by the mathematical community always has a motivation. By the way, $0!=1$ is also a convention. – Piquito Jul 8 '15 at 2:14
• @Ataulfo Yes, but $0! = 1$ is a useful convention and accepted by the mathematical community. $\varphi(0) = 1$ or $\varphi(0) = 0$ or $\varphi(0) = 2$ are not standard conventions and are not accepted by the mathematical community – 6005 Aug 26 '15 at 15:42

yes what you said is true $\phi(n) = n$ if and only if $n=0,1$

Now actually $\phi(n) \leq n-1$ for all $n \geq 2$ and $\phi(n) = n-1$ only occurs when $n$ is prime at this case

• MathWorld says $\phi(0)=1\neq 0$. – user26486 Apr 30 '15 at 16:27

Here you have another proof: For $n=p_1^{\alpha_1}p_2^{\alpha_2}\dots p_k^{\alpha_k}$ with $p_i$ prime numbers, $\phi(n)=n(1-\frac{1}{p_1})(1-\frac{1}{p_2})\dots(1-\frac{1}{p_k}) < n$ as $0<1-\frac{1}{p_i}< 1\ \forall p_i$.

• I've given (almost) the same answer! ;o) – Bernard Apr 30 '15 at 1:00
• Oh yes :) TLTR ( too late to read :D) – Alvaro Fuentes Apr 30 '15 at 1:10
• @Bernard But you unpacked it more. – Robert Soupe Jul 8 '15 at 1:39

$\varphi(n)$ is the number of integers $k$, $1 \le k \le n$, relatively prime to $n$. This gives us immediately that $\varphi(n) \le n$ for all $n$.

But for $n \ge 2$, $n$ is not relatively prime to itself, so we have that $\varphi(n)$ is equivalent to the number of integers $k$, $1 \le k \le n-1$, relatively prime to $n$. Thus $\varphi(n) \le n-1$ for $n \ge 2$. In particular, the only solution to $\varphi(n) = n$ is $n = 1$. ($\varphi(0)$ is not usually defined.)

By definition, $\phi(n)<n$ for $n\ge 2$ since, $(n,n)=n$.

• Why the downvotes?! This is perfectly correct. – 6005 Aug 26 '15 at 15:43