/collatz

Matlab script to visualize collatz conjecture

Primary LanguageMatlabMIT LicenseMIT

Collatz

This is a Matlab script to visualize the Collatz conjecture. To use, save the file and enter collatz(n), replacing n to see a graph of how many steps it takes to get back to 1 for each number from 1 to n.

Here is an example of using the collatz() function in Octave: collatz(1000) result

Octave is a nice online platform that provides much of the functionality that Matlab does and can be found at https://octave-online.net/.