If $G$ has no nontrivial subgroups, show that $G$ must be finite of prime order We know the following fact from gorup theory: If $G$ is a group of prime order then it has no nontrivial subgroups.
Lets try to prove the converse statement: If $G$ has no nontrivial subgroups, show that $G$ must be finite of prime order.
Proof: Suppose by contradiction: If $G$ has no nontrivial subgroups $\Rightarrow$  $G$ is infiinite or $|G|\neq p$.
The case when $G$ is infinite we can rule out using that topic.
Suppose that $|G|=n$ where $n$ is composite $\Rightarrow$ $n=pm$ where $p$ - prime and $m\geqslant 2$. Let $a\in G$ such $a\neq e$ then $a^{pm}=e$.


*

*If $a^p\neq e$ then considering the cyclic group of G, namely $H=\left \langle a^p\right \rangle$ $\Rightarrow$ $1<|H|\leqslant m<pm$ this is a contradiciton.

*If $a^p=e$ then we know that $a\neq e$ and considering the cyclic subgroup of $G$, namely $H=\left \langle a\right \rangle$ $\Rightarrow$ $1<|H|\leqslant p<pm$
So we get two contradiction and it follows that $G$ is finite and its order is prime.
P.S. I think that my post is not duplicate because my solution somewhat is different from given duplicates. And this solution was created by me and it was important for me to understand is it correct or not.
 A: This is correct! Just a few comments, though:

If $G$ has no nontrivial subgroups $\Rightarrow$  $G$ is infiinite or $|G|=p$.

This is probably a typo, where you meant to say $|G| \neq p$?
There is also another small assumption, namely that the group $G$ itself is not trivial, for if it were trivial then it has no non-trivial subgroups, but its order is $1$, which is not prime.

EDIT: I went through the chat discussion linked in the comments under the question. The point Stephen is raising is that the first sentence of the proof is incorrectly worded. I chose to overlook this initially because I assumed English is not the OP's first language.
The point is that the first sentence:

Suppose by contradiction: If $G$ has no nontrivial subgroups $\Rightarrow$  $G$ is infiinite or $|G|=p$

does not express what you want to express in the most precise manner. Another way to read this implication is: "If if $G$ has no nontrivial subgroups then $G$ is infinite or $|G| = p$". This is already incorrect English, but it is also an incorrect way to state that you wish to prove the proposition by contradiction.
Here is how I would rephrase the first sentence.

$G$ is either infinite, or $|G| \neq p$ for any prime $p$, or $|G| = p$ for some prime $p$. We will show that if either of the first two conditions hold and $G$ has no non-trivial subgroups, then we arrive at a contradiction. This will show that if $G$ has no non-trivial subgroups, then $|G| = p$ for some prime $p$.

I hope this helps clarify the chat discussion, somewhat.
