collatz_polynomial


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:

  1. if p0(x) is divisible by x, p1(x) = p0(x) / x.
  2. Otherwise, p1(x) = p0(x) * ( x + 1 ) + 1 mod 2.

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.

Licensing:

The computer code and data files made available on this web page are distributed under the MIT license

Languages:

collatz_polynomial is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

collatz_polynomial_test

collatz, an Octave code which computes and analyzes the Collatz or hailstone or 3n+1 sequence;

Reference:

  1. John D Cook,
    Polynomial analog of the Collatz conjecture,
    27 July 2021,
    https://www.johndcook.com/blog/2021/07/27/polynomial-collatz/

Source Code:


Last modified on 15 September 2022.