By the Fundamental theorem of finitely generated abelian groups, write
with finite. Taking profinite completions gives
If , this is plainly .
Conversely, suppose . Reduction modulo a prime gives
whereas . Choosing first shows . If , choosing a prime divisor of makes , a contradiction. Thus and .
By the Fundamental theorem of finitely generated abelian groups,
with finite. If a nonzero element has a nonzero component in , projection to separates it. Otherwise some integer coordinate is a nonzero ; choose a prime not dividing and reduce that coordinate modulo . This gives a finite quotient in which the element survives, so every finitely generated abelian group is residually finite.