Splitting exact sequences of finite abelian groups 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?)
 A: 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.
A: Assuming we have the short exact sequence
$$0\longrightarrow H\stackrel{f}\longrightarrow G\stackrel{g}\longrightarrow K\longrightarrow 0$$
then the sequence splits iff there exists a homomorphism $\,\gamma:K\longrightarrow G\,$ s.t. $\,g\circ \gamma=Id_K\,$ , iff there exists a homomorphism $\,\phi:G\longrightarrow H\,\,s.t.\,\,\phi\circ f=Id_H\,$ .
You can find a proof of the above, sometimes known as the splitting lemma, here
A: Consider the short exact sequence
$$ 0\to H\stackrel{f}\to G\to K\to 0.$$
Let $H=\langle h\rangle$, and $f(h)=\displaystyle\sum_{i=0}^n a_i g_i$.  Then the SES splits if and only if there exists a homomorphism $\phi\ :\ G\to H$, such that $\phi\circ f\equiv id$.  Now if $\phi(g_i)=k_i h$, then $\phi$ is a homomorphism if and only if
$$ k_i |g_i|\equiv 0\pmod{|h|},\qquad 1\le i\le n.\qquad (1)$$
And we have $\phi\circ f\equiv id$ if and only if
$$ \displaystyle\sum_{i=1}^n a_i k_i\equiv 1\pmod{|h|}.\qquad (2)$$
Condition $(2)$ clearly implies the GCD condition is necessary. I think some Chinese Remainder Theorem stuff will show it is sufficient as well.
