The Collatz Function

Math 242 Modern Computational Mathematics

Define the Collatz function

The Collatz function Col(n) is defined for any positive integer n as follows: if n is even, then Col(n)=(n/2), but if n is odd, then Col(n)=3n+1.

Iterate a fixed number of times

Let's write some code to iterate the Collatz function from some starting integer n.

We can put our code in a module to make it easy to run for different starting values:

makeSeq[start_,numIter_]:=Module[
{},



]