# Thread: Euler Phi function property

1. ## Euler Phi function property

Hello everyone!

I'm working on this problem:

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

Here's my work:

Consider the following cases:

Case 1: $n$ is prime.

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

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

We have $\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 $(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: $n=p^2$, with p prime.

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

Now, I tried other cases that failed (like $p^2q$, $p^2q^2$, $p^3q$). I believe that $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 $n>2$ then $\phi(n)$ is even - that is simple, if $(k,n)=1$ then we also have $(n-k,n)=1$ ... -.

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