Author: Franco Saliola <saliola at gmail.com>
The conjecture is an unsolved conjecture in mathematics. It is
also known as the Collatz conjecture, as the Ulam conjecture (after
Stanislaw Ulam), or as the Syracuse problem. Lothar Collatz was the first
person to propose the problem in 1937.
Consider the following operation on positive integers .
For example, if we apply this transformation to , then we get
since
is even; and if we apply this operation to
, then we get
since
is odd.
Exercises
Write a function that implements this operation, and compute the images of
.
If we start with and apply this operation, then we get
.
If we now apply this operation to , then we get
.
Applying the operation to outputs
.
Continuing in this way, we get a sequence of integers.
For example, starting with , we get the sequence:
Notice that this sequence has entered the loop . One formulation of the Collatz conjecture is the following.
3n+1 conjecture: For every positive integer, the resulting sequence will always reach the number
.*
Exercises
Write a function that takes a positive integer and returns the sequence
until it reaches . For example, for 6 , your function will return
[ 6, 3, 10, 5, 16, 8, 4, 2, 1 ]. Find the largest values in the
sequences for 1, 3, 6, 9, 16, 27
(Hint : You might find a while helpful here. Below is a very simple example that repeatedly adds 2 to the variable x until x is no longer less than 7.)
x = 0 while x < 7: x = x + 2 print x
Use the line command to plot the sequence for 27.
Write an @interact function that takes an integer and
plots the sequence for
.
The number of steps it takes for a sequence to reach is the
stopping time . For example, the stopping time of
is
and the stopping time of
is
.
Exercises
Write a function that returns the stopping time of a poisitve integer
. Plot the stopping times for
in a
bar chart.
Find the number less than with the largest stopping time. What
is its stopping time? Repeat this for
.
If is odd, then
is even. So we can instead consider the
-operator that maps
to
, if
is even; and to
, if
is odd.
Exercises
Implement the -operator.
Consider the following function.
Construct as a symbolic function and use Sage to verify that
for all
, where
is
the
-operator. Argue that
is a smooth
extension of
to the complex plane.
Let be the complex function:
Construct as a symbolic function, and show that
and
are equal. Hint: Explore the various methods for symbolic
functions beginning with .trig_.
Use the complex_plot command to plot g in the domain
and
.
Consider the composition
(where there are
copies of
in this composition). Use
complex_plot and graphics_array to plot
,
,
, ...,
on the domain
and
.
(Hint: To speed things up or control the percision of the computations, you may want to replace pi in your equation with CDF.pi(). Type CDF? and CDF.pi? for more information.)
Generate some really nice images of that illustrate the
fractal-like behaviour of
. (Hint: You may want to explore the
plot_points and interpolation options for the complex_plot
command.)