Suppose n has only one prime factor. Then n=pα for some α>1 and prime p. Then φ(n)=pα−1(p−1) divides pα−1, which is impossible since α≥2. Thus n has at least two prime factors.
Suppose n=pαqβ, where p=q are primes, α≥1 and β≥1. Here φ(n)=pα−1qβ−1(p−1)(q−1) and n−1=pαqβ−1. Thus φ(n)∣((n−1)(p−1)) implies that α=1=β and (p−1)(q−1) divides pq−1. This implies that (p−1)∣(q−1) and (q−1)∣(p−1), forcing p=q.
If n has three distinct prime factors, say p,q,r, we see as in the earlier case n=pqr and (p−1)(q−1)(r−1) divides pqr−1. Taking p−1=x,q−1=y and r−1=z, we see that
t=(p−1)(q−1)(r−1)pqr−1=1+x1+y1+z1+xy1+yz1+zx1,
is an integer. We also observe that no prime can be even. (Otherwise pqr−1 is odd whereas one of p−1,q−1,r−1 is even.) Thus we may assume 3≤p<q<r, so that x≥2,y≥4 and z≥6. Thus
1<t≤1+21+41+61+81+121+241=1+2428<3.
Thus t=2 and hence
x1+y1+z1+xy1+yz1+zx1=1.
If p≥5, we have x≥4,y≥6 and z≥10. In this case,
1=x1+y1+z1+xy1+yz1+zx1≤41+61+101+241+601+401=12072<1.
Thus p=3 and x=2. We obtain
y1+z1+21(y1+z1)+yz1=21.
This may be written in the form (y−3)(z−3)=11. We thus get y=4,z=14. In turn, we have q=5 and r=15. But then r is not a prime. Thus the number of distinct prime factors of n is more than 3.