Functions becoming undefined when evaluated

I’m so confused I don’t even know how to phrase my Question title.

My function nextCol works until I use colLength, then nextCol doesn’t work anymore.

$RecursionLimit = Infinity;
nextCol[m_, n_] :=
Module[{},
t = m;
Do[While[Mod[t, Prime[j]] == 0, t = t/Prime[j]], {j, 1, n – 1}];
Return[If[t == 1, 1, t*Prime[n] + 1]]];
colLength[m_, n_] :=
Module[{},
Return[If[m == 1, 1, 1 + colLength[nextCol[m, n], n]]]];

nextCol[10001, 5]
(* 110012 *)

colLength[10001, 5]
(* DING! from my laptop but no error or warning message *)

nextCol[10001, 5]
(* nextCol[10001, 5] *)

It’s like nextCol somehow made Mathematica forget the definition of nextCol.

And this problem doesn’t happen for most inputs pairs.

Is this an Mathematica bug or did I do something wrong?

=================

3

 

The ding you hear is your kernel crashing, probably because you removed the recursion limit and exhausted the stack space. Once the kernel crashes, it forgets any definitions you made.
– MarcoB
Jun 28 ’15 at 1:53

  

 

@MarcoB Yeah, that was the problem. Thanks. If you want to put this as an Answer, I will Accept it.
– Jerry Guern
Jun 28 ’15 at 2:02

=================

1 Answer
1

=================

The ding you hear is your kernel crashing, probably because you removed the recursion limit and exhausted the stack space. Once the kernel crashes, it forgets any definitions you made.