PID and finitely generated module 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: (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.
A: Let $k$ be the field of fractions of $R$. I claim that $M$ is torsion iff $k\otimes_R M=0$. One direction is clear. Now suppose $M$ is f.g. and pick a set of generators $x_1,\ldots,x_n$. We can order the $x_i$ such that $\{x_1,\ldots,x_r\}$ is l.i. and such that $\{x_1,\ldots,x_r,x_k\}$ is l.d. for each $k>r$. In particular there is $a_k$ nonzero such that $a_kx_k\in \langle x_1,\ldots,x_r\rangle$. Let $a=a_1\cdots a_k$. We have a morphism $\eta:M\to F$ where $F\simeq R^r$ given by $x\mapsto ax$. You should check that $\ker \eta={\rm tor}\,M $. Thus $\overline M=M/{\rm tor}\,M$ injects into the free $R$-module $F$, since $R$ is a PID, we know that $\overline M$ is free. But we have a surjective morphism $\pi:M\to \overline M$ that sends $x$ to its class modulo ${\rm tor}\; M$. Since $\overline M$ is free, we have a splitting $M=\ker\pi\oplus F'$ where $F'\subseteq M$ is free of rank $r$ and $\ker \pi={\rm tor}\,M$. If $M$ is not torsion then $r>0$, and $k\otimes_R M\simeq k^r\neq 0$. Can you take it from here? This in fact gives that $M={\rm tor}\,M\oplus F$ with $F\simeq R^r$, $r=\dim_k(k\otimes_R M)$, so that ${\rm tor}\, M\neq M\implies r>0$ and hence ${\rm Hom}_R(M,R)\simeq {\rm Hom}_R(R^r,R)$ since you've already shown the torsion part vanishes. 
N.B.: Here we're using the "big gun" that submodules of free modules over PIDs are free. 
