Heights of Collatz Trajectories

Math 242 Modern Computational Mathematics

Preliminary Code

First we define the Collatz function col(n).

col[n_?OddQ]:=3n+1
col[n_?EvenQ]:=n/2

Here is a module to compute the Collatz trajectory with some starting value n. The loop in this module stops when either a 1 is reached or the trajectory contains maxIter terms. Note that maxIter is an optional parameter with default value 100000.

computeTrajectory[start_,maxIter_:100000]:=Module[{traj={start},n=start},
(* compute the trajectory until we find 1 *)
While[n!=1&&Length[traj]<maxIter,
n=col[n];
AppendTo[traj,n];
];
(* return the trajectory *)
traj
]

Here is a function to plot Collatz trajectories. The input to this function should be a trajectory, supplied as a list of integers.

plotTrajectory[trajectory_]:=ListPlot[trajectory,PlotRange->All,AxesLabel->{"iteration","value"},Joined->True,PlotStyle->Orange,Mesh->All,MeshStyle->{Blue,PointSize[Medium]}]

Verify the Collatz Conjecture up to n=10000

Asking good mathematical questions

Asking good mathematical questions is not only an art, but also an important skill to develop. A good mathematical question:

is interesting to you;

is not an question whose answer is known to you;

is not a question you've seen before, or at least not exactly;

is a question about which you can begin to make computational investigations.

(These four criteria are from Barry Mazur and William Stein, in Prime Numbers and the Riemann Hypothesis.)

Today we will practice asking good mathematical questions about Collatz trajectories, and specifically about heights of Collatz trajectories.

Heights of Collatz trajectories

Today we will explore the heights of Collatz trajectories. As in the text, let height(n) denote the maximum value in the Collatz trajectory starting with n.