Group with exactly $n$ elements of order $n$, then $n$ has at most two prime divisors This question is in a introductory abstract algebra book.
Let $n > 1$, and $G$ a group with exactly $n$ elements of order $n$, show that at most two distinct primes divide $n$.
My attempt:
Let $k$ be the number of cyclic groups of order $n$, we can generate these subgroups from the $n$ elements of order $n$, if that's the case then every one of those groups has exactly $\phi(n)$ elements of order $n$ that can't be shared with other of the $k$ cyclic subgroups.
Then as we have exactly $n$ elements of order $n$ then it must happen that $n = k \cdot \phi(n)$ and that's where I'm stuck. I tried expressing $\phi(n)$ as $$n \cdot \prod_{p|n} 
\left(1 - \frac{1}{p}\right)$$ but I don't see how I can get the "at most two primes" from there. I just arrived to $$ k \cdot \prod_{p|n} \left(1 - \frac{1}{p}\right) = 1. $$
 A: I think I can answer the question myself now, thanks to the comments that drop me some hints.
Let $k$ be the number of cyclic groups of order $n$, we can generate these subgroups from the $n$ elements of order $n$, if that's the case then every one of those groups has exactly $\phi(n)$ elements of order $n$ that can't be shared with other of the $k$ cyclic subgroups.
Then as we have exactly $n$ elements of order $n$ then it must happen that $n = k \cdot \phi(n)$. Also we now that:
$$ \phi(n) = n \cdot \prod_{p|n} \left(1 - \frac{1}{p}\right) $$
So from $ n = k \cdot \phi(n) $ we get that
$$ n = k \cdot n \cdot \prod_{p|n} \left(1 - \frac{1}{p}\right) $$
$$ \Rightarrow k \cdot \prod_{p|n} \left(1 - \frac{1}{p}\right) = 1$$
$$ \Rightarrow k = \frac{\prod_{p|n} p }{\prod_{p|n} (p -1)} $$
Note that if $p$ and $q$ are two primes such that $ 2 < p, q $ then ${p - 1}\nmid q$.
And that if $p = 2$ then $ p - 1 $ divides any prime and if $q = 2$ and $ p = 3$ then $p-1 = q$
So using the information above we can see that in
$$ \frac{\prod_{p|n} p }{\prod_{p|n} (p -1)} $$ as the primes $p$ are different from each other $p - 1 \nmid q$ if $p$ and $q$ are different prime factors of $n$ and also $p-1 \nmid p$ if $p > 2$ this leaves us with the only possibility that that one of the prime factors must be $2$ and the other one can be $3$ so that $3-1 = 2 \mid 2$ any other primes would need for $p-1$ to divide $p$ or to divide another prime which is not posible.
Finally $k$ can only be: $$ \frac{2}{2-1} = 2 \quad \text{or} \quad \frac{2 \cdot 3}{(2-1)\cdot(3-1)} = 3 $$
So the only primes that can divide $n$ are $2$ and $3$, and therefore $n = 2^s \cdot 3^t$ for $s \in \mathbb{N} $ and $ t \in \mathbb{N} \cup {0}$.
