I am trying to prove the following statements:
Let $R$ be a PID and $M$ a finitely generated $R$-module. Prove:
(a) $M$ is torsion module iff $\operatorname{Hom}_R(M,R)=0$
(b) $M$ is an indecomposable module iff $M \cong R$ or $\exists \space p \in R$ irreducible and $n \in \mathbb N$ such that $M \cong R/ \langle p^n \rangle$
I got stuck with one implication in (a) and I don't know what to do in (b).
In (a), if $M$ is a torsion module, then take $f \in \operatorname{Hom}_R(M,R)$. Suppose $\{x_1,...,x_n\}$ is a set of generators of $M$, let $a_i \in R \setminus \{0\} : a_ix_i=0$, now take $x \in M$, we have $x=b_1x_1+\cdots+b_nx_n$. Define $a=\prod_{i=1}^na_i$, then $$0=f(ax)=af(x)$$Since $R$ is an integral domain and $a \neq 0$, it must be $f(x)=0$. It follows $f=0$.
I would appreciate suggestions for the other direction and for part (b). Thanks in advance.
(a) As you probably know $M=t(M)\oplus F$, where $t(M)$ is the torsion submodule of $M$ and $F$ is free of finite rank. Then $\operatorname{Hom}(M,R)=\operatorname{Hom}(t(M)\oplus F,R)\simeq \operatorname{Hom}(t(M),R)\oplus \operatorname{Hom}(F,R)$. As you already proved $\operatorname{Hom}(t(M),R)=0$, while $\operatorname{Hom}(F,R)\neq 0$ unless $F=0$.
(b) If $M=R$ then it is indecomposable: if $R=I+J$ with $I\ne 0$ and $J\ne 0$, then $0\ne IJ\subseteq I\cap J$, so we can't have $I\cap J=0$.
If $M=R/(p^n)$ then it is indecomposable: the ideals of $R/(p^n)$ are $(p^i)/(p^n)$ with $i=0,1,\dots,n$, so they can intersect trivially.
If $M$ is indecomposable, then from $M=t(M)\oplus F$ we must have $M=t(M)$ or $M=F$. If $M=F$, then $F$ is of rank one, so $M\simeq R$. If $M=t(M)$, then $M$ must be cyclic. (Here I've used the structure theorem.) So $M\simeq R/(a)$. If $a=bc$ with $(b,c)=1$, then $R/(a)\simeq R/(b)\oplus R/(c)$, a contradiction. It follows that $a=p^n$, a power of a prime element.