TITLE: Splitting exact sequences of finite abelian groups
QUESTION [6 upvotes]: I would like to find a condition for an exact sequence of abelian groups
$$
0\to H\to G\to K\to 0
$$
to split. Assume for simplicity that $H=\langle h \rangle$ is cyclic, and choose a basis for $G= \langle g_1 \rangle \oplus \ldots \oplus \langle g_n \rangle$. Write $h= \sum a_i g_i$, with $0 \leq a_i < o(g_i)$, where $o(g_i)$ is the order of $g_i \in G$.
By looking at examples, it seems to me that the exact sequence splits if and only if
$$
\gcd(o(h), a_1, \ldots, a_n)=1.
$$
Is this last statement correct? (and, if so, why?)

REPLY [2 votes]: This is wrong, as shown by the accepted answer to my question on MO:
https://mathoverflow.net/questions/107768/on-the-existence-of-a-direct-summand-containing-a-fixed-subgroup
A simple example is the subgroup generated by $\langle (2,1) \rangle $ inside $\mathbb{Z}_8 \oplus \mathbb{Z}_2$. This is a subgroup of order $4$ whose quotient is cyclic of order $4$, generated by the equivalence class of $(1,0)$. Clearly $\mathbb{Z}_4 \oplus \mathbb{Z}_4 \neq \mathbb{Z}_8 \oplus \mathbb{Z}_2$.
The answer of Steve D shows that the GCD condition is necessary, but in fact it is not sufficient as this example clearly shows.