Find all n such that $\phi(n) = n/2$ My idea for the solution is something like this:
Since $2 | n$, $n = 2^a p_1^{e1} p_2^{e2} \cdots p_t^{et}$ where $a \geq 1$.
Then, $n/2 = \phi(2^a) \phi(p_1^{e1}) \phi(p_2^{e2}) \cdots \phi(p_t^{et})$.
Looking at the case that $t = 0$,
$n/2 = \phi(2^a) = 2^{a-1}$, and therefore $n = 2^a$.
Otherwise, $n = 2^a \phi(p_1^{e1}) \phi(p_2^{e2}) \cdots \phi(p_t^{et}) = n = 2^a p_1^{e1} p_2^{e2} \cdots p_t^{et}$. Since $\phi(n) < n$, this is a contradiction, and therefore, the only $n$'s that apply are the powers of 2.
Is this right? Also, we were asked to find $n$ such that $\phi(n) = n/3$. How would I go about that one?
 A: You know that 
$$\frac{\varphi(n)}n
=\prod_{p|n, p\text{ prime}} \left[1-\frac 1p\right]
$$
So for every prime $p_0$ $$\prod_{p|n, p\text{ prime}}\left[1-\frac 1p\right]=\frac 1p_0$$
implies, using unicity of decomposition in irreductible fraction: 
$$\{p|n, p\text{ prime}\}=\{p_0\}$$
A: Hint:
Use the fact that if $\;n=p_1^{a_1}\cdot p_k^{a_k}\;,\;\;p_i\;$ primes, $\;a_i\in\Bbb N\;$ , then
$$\phi(n)=n\prod_{i=1}^k\left(1-\frac1{p_i}\right)$$
so
$$\frac n2=n\prod_{i=1}^k\left(1-\frac1{p_i}\right)\iff 2\prod_{i=1}^k\left(1-\frac1{p_i}\right)=1\iff\ldots$$
Take it from here...
A: Without using the product formula.
If $\phi(n)=\frac{n}{2}$, then $n$ must be even (since otherwise $\frac{n}{2}$ is not an integer.)
But if $n=2m$ is even, then $2,4,6,\cdots,2m$ are not relatively prime to $n$. If $p$ is an odd prime divisor of $n$, then the set of numbers relatively prime to $n$ would not include any even number nor $p$, which means that $\phi(n)<\frac{n}{2}$.
So the only prime divisors of $n$ can be $2$.
