Taking $n$ for $n=p_1^{a_1}...p_k^{a_k}$ (being $p_i$ prime numbers)and applying it to Euler's totient function, we would get $\phi(n) = p_1^{a_1-1}...p_k^{a_k-1}(p_1-1)...(p_k-1)$
If we take $d=2$, we can easily verify that $n=4$ satisfies the condition, since $\phi(4) =$ $\frac{n}{d} = 2$
If we take $d=5$, things get a little more complicate, and the way I've seen others tackle it is by verifying the existence of said $n$ for different values of $k$.
For $k=1$, we have that $(p_1-1)=5p_1$, after dividing out the exponential terms from both sides. This requires $n \notin \mathbb{Z}$ so doesn't satisfy the condition here
Here comes my first question: for $k=2$, it is said that necessarily $p_1=2$ (considering $p_1<p_2$), which I don't understand why. Maybe it has something to do with the fact that $\phi(n)$ is even for $n>2$? After that, following similar steps it is shown that there cant be an $n$ in integers that satisfies it
For $k \geq 3$, it is said that $\phi(n) \equiv 0\ (\textrm{mod}\ 4)$, which shows that it can't be divisible by $5$. It is, therefore, proven that $\nexists n \in \mathbb{Z}: \phi(n) = \frac{n}{5}$. I, however, again struggle to understand why $\phi(n)$ is divisible by $4$ in this case
What I am trying to achieve here is understand this solution and apply this technique for different values of $d$.
That is, how could I apply a similar approach to resolve this problem for, say, $d=3$ or $d=7$?
The only possible solution is $d=1$, $d=2$ or $d=3$.
$\phi(n)=\frac{n}{d}$ is equivalent to $d = \frac{n}{\phi(n)}$. As $n=p_1^{a_1}\cdots p_k^{a_k}$ implies $\phi(n)=p_1^{a_1-1}\cdots p_k^{a_k-1}\cdot (p_1-1)\cdots(p_k-1)$, we see that $d$ must have the form $$d=\frac{p_1\cdots p_k}{(p_1-1)\cdots(p_k-1)}.$$
Note that the numerator is divisible by $2$ at most once, while the denominator is divisible by $2$ at least $k-1$ times. This shows that $k\leq 2$, i.e. we have at most two primes.
If $k=0$, then $n=1$, and we see $\phi(1)=1$ (mostly by convention), giving $d=1$.
If we have only one prime, i.e. $k=1$, the prime must be $2$, since otherwise the numerator is odd and denominator is even. Then $d=2$.
If $k=2$, then $p_1=2$ still, as the other prime will contribute a factor of $2$ in the denominator (i.e. $\phi(p_2)$ is even). Let us see what $p_2$ can be.
We have that $\phi(p_2)=p_2-1=2\cdot q$ for some $q\in \Bbb{N}$, and we immediately get $gcd(p_2,q)=1$. We see that
$$d=\frac{2\cdot p_2}{2\cdot q} = \frac{p_2}{q},$$
and by the relatively prime condition, we must then have $q=1$, i.e. $p_2=3$. Then $d=3$. No other possible values exist.