collatz, a Python code which computes the Collatz sequence.
The rules for generation of the Collatz sequence are recursive. If T is the current entry of the sequence, (T is assumed to be a positive integer), then the next entry, U is determined as follows:
Although the Collatz sequence seems to be finite for every starting point, this has not been proved. Over the range of starting values that have been examined, a great irregularity has been observed in the number of entries in the corresponding sequence.
The Collatz sequence is also known as the "hailstone" sequence or the "3n+1" sequence.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
collatz is available in a MATLAB version and an Octave version and a Python version..
collatz_dict, a Python code which demonstrates how the Python dict variable type can be used to efficiently record data about the Collatz iteration.
collatz_recursive, a Python code which demonstrates recursive programming by considering the simple Collatz 3n+1 problem.
polpak, a Python code which evaluates a variety of mathematical functions, polynomials, and sequences, including Bell, Benford, Bernoulli, Bernstein, Cardan, Catalan, Charlier, Chebyshev, Collatz, Delannoy, Euler, Fibonacci, Gegenbauer, Gudermannian, Hermite, Hofstadter, Jacobi, Krawtchouk, Laguerre, Lambert, Legendre, Lerch, Meixner, Mertens, Moebius, Motzkin, Phi, Sigma, Stirling, Tau, Tribonacci, Zernike.