Finite group with at most one subgroup for each order. Let $G$ be a finite group.
I want to prove the following propositon.


  If for every positive integer $n$, the number of subgroups of $G$ of order $n$ is $1$ or $0$, then $G$ is
  cyclic.


Is my proof right?

$$\begin{align*}
f(d)&amp;＝\text{The number of element of }G\text{ of order }n\\
&amp;\leq(\text{number of subgroups of order }d)\times(\text{number of generators of }G)
\end{align*}$$

Above inequality holds for any finite group $G$.

From assumption, we can deduce
$$f(d)\leq \text{number of generators of }G = \varphi(d)$$

On the other hand, $n$ is the sum of $f(d)$ where $d$ divides $n$.

And the sum is less than the sum of $\varphi(d)$ where $d$ divides $n$. And the last sum is $n$, so, $f(d)=\varphi(d)$.

In particular, $f(n)=\varphi(n)\geq 1$, so $G$ has an element $a$ which has order $n$. Therefore, $G=\langle a\rangle$.
The argument has a bunch of typos and omissions,  and is not very clear, but is essentially correct.

You define $f(d)$ to be the number of elements of order exactly $d$ in $G$. Then we note that if $x$ is an element of order $d$, then so are $x^a$ for any $a$, $1\leq a\leq d$, $\gcd(a,d)=1$; so each element of order $d$ gives you $\varphi(d)$ other elements of order $d$. Now, if $H$ is a subgroup of order $d$, then if it is cyclic it contains exactly $\varphi(d)$ elements of order $d$, and if it is not cyclic, then it contains $0$, and hence fewer than $\varphi(d)$ elements. Each element of order $d$ is counted this way.

That means that $f(d)$ is, at most, the number of subgroups of order $d$ times $\varphi(d)$. The typos in your first equation are:


The $n$ on the first line; and
It's not "generators of $G$", in the second line, it's generators of the subgroup of order $d$.


Now, since by assumption there is at most one subgroup of order $d$, that means that $f(d)\leq\varphi(d)$ for each $d$. That's correct.

Since $|G|=\sum_{d|n}f(d)$, then
$$n = |G|=\sum_{d|n}f(d) \leq\sum_{d|n}\varphi(d).$$
But it is known that $\sum_{d|n}\varphi(d) = n$, so we have equality throughout. In particular, for every $d|n$, $f(d)=\varphi(d)$. That's correct, though poorly worded.

And then you conclude that since $\varphi(n)\geq 1$, then $f(n)\geq 1$, which means $G$ contains at least one element of order $n$, and thus is cyclic. Again, correct.
Let $p_1^{r_1}\cdot p_2^{r_2}\cdots p_n^{r_n}$ be the prime factorization of $m:=\text{exp}(G)$. Each cyclic $G$ subgroup $\langle g\rangle$ must also be a normal $G$ subgroup as it is the unique cyclic subgroup of that order. Choose $g_1,g_2,\dots ,g_n\in G$ such that $\text{ord}(g_i)=p_i^{r_i}$ and compose the internal direct sum $$\langle g_0\rangle:=\langle g_1\rangle\oplus\langle g_2\rangle\oplus\cdots\oplus\langle g_n\rangle$$ Finally, given any $g\in G$ then $m=\text{ord}(g_0)$ is a multiple of $|\langle g\rangle|$ which must equal the size of a $\langle g_0\rangle$ subgroup so that we may conclude $\langle g\rangle\subseteq\langle g_0\rangle$. Therefore $G=\langle g_0\rangle$.