Find all finite groups $G$ s.t for any $a,b\in G$ either $a$ is a power of $b$ or $b$ is a power of $a$

Find all finite groups $$G$$ s.t for any $$a,b\in G$$ either $$a$$ is a power of $$b$$ or $$b$$ is a power of $$a$$

I think i showed that all such groups are $$Z_{p^n}$$ for $$p$$ prime, is this correct? I first showed that the group must be cyclic by considering the element of the largest order $$\langle a\rangle$$ and achiveing contradiction if $$\langle a\rangle\not= G$$., and then that if $$Z_n$$ with $$n$$ composite then it does not have this property. as there are two disjoint cyclic subgroups of coprime orders.

Is this correct? Are all groups such groups $$Z_{p^n}$$?

• Yes, this is correct. P.S. use \langle and \rangle, not < and >. Commented Aug 18, 2020 at 20:59
• @ArturoMagidin you just told me I very possibly passed my qual! Thank you Commented Aug 18, 2020 at 21:00
• That may depend on how you justified the “achieving a contradiction if $\langle a\rangle\neq G$”, of course... ;-) Commented Aug 18, 2020 at 21:01
• @ArturoMagidin That is true :P you let $b \not \in \langle a \rangle$ then the property implies that $<b>$ contains $a$ and so has larger order. Commented Aug 18, 2020 at 21:03

Yes, if you take $$a$$ with maximal order and, by contradiction, there is $$b\notin\langle a\rangle$$, then $$a=b^n$$ for some $$n>1$$, so $$b$$ has larger order than $$a$$.
Therefore $$G$$ is cyclic.
Now we can prove that the order of $$G$$ must be a prime power: you cannot exclude “composite” (a minor slip, but relevant).
If $$|G|$$ is divisible by two distinct primes $$p$$ and $$q$$, then $$G$$ has subgroups of order $$p$$ and $$q$$, but these have trivial intersection, so the group cannot have the stated property.
A cyclic group of order $$p^n$$ ($$p$$ a prime) has the stated property.