If $\phi$ is Euler's Phi Fuction we want to find all $n \in \mathbb{Z^+}: \phi(n)=2$.
First of all $n>2$. Let $n=2^k3^lm $ with $k,l\in \mathbb{N},\ m\in \mathbb{Z^+}$ with $\text{gdc}(m,2)=\text{gdc}(m,3)=1.$ So $\phi(n)=2 \iff \phi(2^k3^lm)=2 \iff \phi(2^k )\phi(3^l) \phi(m)=2 $
- If $k,l>0 \implies 2^{k-1}3^{l-1}\phi(m)=2\implies k=l=1 ,\ m=1\implies n=6.$
- If $k=0,\ l>0 \implies2\cdot3^{l-1}\phi(m)=2\implies l=1,\ m=1\implies n=3.$
- If $l=0,\ k>0 \implies 2^{k-1}\phi(m)=2 \implies 2^{k-2}\phi(m)=1\implies k=2,\ m=1 \implies n=4.$
- But what happens if $k=l=0 \implies n=m: \text{gcd}(m,6)=1$ ?
Thank you.
If $1<n=\prod p_i^{k_i}$ is the factorization in primes of $n$ we have $\phi(n)=\prod p_i^{k_i-1}(p_i-1)$. So if $\phi(n)=2$ we must have $p_i-1\in \{1,2\}$ and so $p_i\in \{2,3\}$ for all $i$. So $\gcd(n,6)=1$ isn't possible.