What's the simplest example (if any) of two non-isomorphic groups *G* and *H* such that $G \times G \cong H \times H$? A similar question can be asked for $n^{th}$ powers for fixed $n > 1$.

The Krull-Remak-Schmidt theorem guarantees a "unique factorization" into direct products of directly indecomposable groups. It applies to finite groups, and more generally for groups that satisfy both the ascending and descending chain conditions on normal subgroups.

Wherever such a unique factorization holds, it would follow that isomorphic $n^{th}$ powers implies isomorphic groups (by the usual expedient on counting the multiplicities of each directly indecomposable factor on both sides). So, counterexamples must be infinite at the very least.

However, I'm not able to come up with *any* counterexample nor can I see an easy proof. [EDIT: Resolved now in one of the answers. The question below still seems open.]

Also related: can we have groups *G,H* such that $G^2 \cong H^3$ but *G* is not the cube of any group and *H* is not the square of any group? Again, this fails in the cases where we have a unique factorization, because we can count multiplicities of indecomposables. $2$ and $3$ can be replaced by any two relatively prime numbers above.

Incidentally, this is somewhat related to an earlier question on Math Overflow: When is A isomorphic to A^3?

A similar question can probably be asked in many other categories.