Collatz conjecture
Learning project: PHP
The Collatz conjecture is one of the most famous unsolved problems in mathematics. The conjecture asks whether repeating two simple arithmetic operations will eventually transform every positive integer into 1.
What’s the program about?
Although the case remains unsolved, it became a valuable exercise to compile an algorithm that tests the Collatz conjecture. The presented PHP program assumes the user enters a number (positive or negative) to start the series. The results show indeed that starting with any positive number, the sequence ends at 1, and starting with a negative number, the sequence ends at either -1, -5 or -17.