collatz_polynomial, an Octave code which implements the Collatz polynomial iteration, a polynomial analog of the numerical iteration that is also known as the 3n+1 conjecture or the hailstone sequence.
Let p0(x) be a polynomial with integer coefficients mod 2. Then define the next Collatz polynomial p1(x) as follows:
This transformation can be repeated, generating a Collatz polynomial sequence. For all starting polynomials checked so far, the sequence reaches the polynomial p(x) = 1, at which point the convention is to halt. (There is also the exceptional polynomial p(x)=0.) It is interesting to investigate the number of steps required to drive a particular polynomial to 1, and to find patterns in this behavior.
The computer code and data files made available on this web page are distributed under the MIT license
collatz_polynomial is available in a MATLAB version and an Octave version and a Python version.
collatz, an Octave code which computes and analyzes the Collatz or hailstone or 3n+1 sequence;