I'm doing exercises from Hungerford's book "Abstract Algebra: An Introduction". The exercise is in section 8.2, numbered 22.
I would like someone to check my proof, as I have reasonable doubts that it is somehow incorrect, mainly because I know that $p$-groups of same order are not necessarily isomorphic. The proof is by induction as you will see, and I'm especially shaky on the inductive step.
Let $G$ and $H$ be finite abelian groups with this property: For each positive integer $m$ the number of elements of order $m$ in G is the same as the number of elements of order $m$ in H. Prove that $G \simeq H$.
Proof: It follows from the problem description that the orders of $G$ and $H$ are equal. It also follows that $p$-groups of both group $G$ and $H$, for every possible $p$, have the same order and the same amount of elements of any order $m$ . Also, number of $p$-groups of both groups is the same. My goal will be to prove that in this case the $p$-groups of same order are isomorphic. For this I will use Lemma 8.6 from Hungerford's book:
LEMMA 8.6 Let $G$ be a finite abelian $p$-group and $a$ an element of maximal order in G. Then there is a subgroup of $K$ such that $G = \langle a\rangle\oplus K$.
If two $p$-groups are of order 2, then clearly they are isomorphic. We map the identity element to identity in the other group, and the second element must have order two which we also map to the element of order 2 in the other group. Assume inductively that all $p$-groups of order less than $n$, with the property from the exercise, are isomorphic to each other. Assume $A$ and $B$, $p$-groups, have order $n$, and have the property from the exercise. Then by the presented lemma, for some elements $a \in G$, $b \in H$ of maximal order, $A = \langle a\rangle \oplus K$ and $B = \langle b\rangle \oplus L$, for some subgroups $K,L$ which have orders less than $A$ and $B$. $K$ and $L$ are of course also $p$-groups, as they are subgroups of $p$-groups. It's easy to see that $K,L$ have the same order, as $|A| = |\langle a \rangle||K|$, $|B| = |\langle b \rangle||L|$, and it follows from the exercise description that the order of highest element in $A$ and $B$, namely $a$ and $b$ are equal. So then, orders of $K$ and $L$ are equal, and by induction hypothesis are isomorphic. $\langle a \rangle$ and $\langle b \rangle$ are isomorphic since both are cyclic groups of the same order. So we have that $A \simeq B$, all $p$-groups of $G$ and $H$ are isomorphic, so $G$ and $H$ are isomorphic.