COLLATZ is a MATLAB library 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 JAVA version and a MATHEMATICA version and a MATLAB version and a PERL version.
COLLATZ_PARALLEL is a MATLAB program which seeks the maximum Collatz sequence between 1 and N; it runs in parallel using MATLAB's "parfor" facility.
POLPAK is a FORTRAN90 library which includes the routine collatz_count for counting the length of a Collatz sequence.
SEQUENCE_STREAK_DISPLAY is a MATLAB program which can display a "streak plot" of a van der Corput sequence.
TABLE is the data format which is used for the file output by COLLATZ_WRITE.
collatz_27 lists the Collatz sequence for seed 27.
collatz_count lists the number of entries in each Collatz sequence with seeds from 1 to 100.
You can go up one level to the MATLAB source codes.