The question is:
Prove that if $_RM$ is either artinian or noetherian and if $m,n\in\mathbb{N}$ with $M^{(m)}\cong M^{(n)}$, then $m=n$. Here, $M^{(m)}$ denotes the direct sum of $m$ times $M$.
I had tried to solve using induction over $n$ and an isomorphism between $M^{(n)}/M$ and $M^{(n-1)}$, but I have many troubles with that.
There is a suggestion (and I can't imagine how to use): Use the next lemma
Let $M$ be a module and let $f$ be an endomorphism of $M$.
$(1)$ If $M$ is Artinian, then $\operatorname{Im}\, f^n + \ker\, f^n=n$ for some $n$, whence $f$ is an automorphism if and only if $f$ is monic;
$(2)$ If $M$ is Noetherian, then $\operatorname{Im}\, f^n\cap \ker\, f^n=0$ for some $n$, whence $f$ is an automorphism if and only if $f$ is epic.