# Thread: Euler Phi function property

1. ## Euler Phi function property

Hello everyone!

I'm working on this problem:

Q: Find all $\displaystyle n$ such that $\displaystyle \varphi\!\left(n\right)=n-2$.

Here's my work:

Consider the following cases:

Case 1: $\displaystyle n$ is prime.

In $\displaystyle n$ is prime, then $\displaystyle \varphi\!\left(n\right)=n-1$. However, if this is supposed to satisfy the above requirement, then we must have $\displaystyle n-1=n-2$ which is not possible for any $\displaystyle n$.

Case 2: $\displaystyle n=pq$, with p and q prime.

We have $\displaystyle \varphi\!\left(pq\right)=\varphi\!\left(p\right)\v arphi\!\left(q\right)= (p-1)(q-1)$. To satisfy the above equality, we must have $\displaystyle (p-1)(q-1)=pq-1\implies pq-p-q+1=pq-2\implies p+q=3$ which is not possible since 1 is not a prime.

Case 3: $\displaystyle n=p^2$, with p prime.

We have $\displaystyle \varphi\!\left(p^2\right)=p^2-p$. To satisfy the above equality, we must have $\displaystyle p^2-p=p^2-2\implies p=2$. Therefore $\displaystyle n=4$ is a solution.

Now, I tried other cases that failed (like $\displaystyle p^2q$, $\displaystyle p^2q^2$, $\displaystyle p^3q$). I believe that $\displaystyle n=4$ is the only solution, but my main question is when do I know where to stop with all these different cases?

Any help is appreciated!

2. Note that if $\displaystyle n>2$ then $\displaystyle \phi(n)$ is even - that is simple, if $\displaystyle (k,n)=1$ then we also have $\displaystyle (n-k,n)=1$ ... -.

That implies that $\displaystyle n$ is even -by your equation-, so if $\displaystyle n>4$, $\displaystyle n$ has at least 3 divisors not coprime to it (n, 2 and n/2) (*), but then $\displaystyle \phi(n)<n-2$ a contradiction!.