Note: You will need to have Python 3 and Rust installed on your computer!
To check how many iterations a number takes to reach 1, run the number_of_iterations.py file as follows:
python3 number_of_iterations.py
Output:
Enter an integer: 9
9 took 19 iterations!
To check not only the number of iterations it takes for each number in a range to reach 1 but also which number takes the most iterations, run the max_iterations.rs file as follows:
Be sure to change the values of MIN and MAX which are used for the range.
rustc -O max_iterations.rs && ./max_iterations
Output:
1 took 0 iterations!
2 took 1 iterations!
3 took 7 iterations!
4 took 2 iterations!
5 took 5 iterations!
6 took 8 iterations!
7 took 16 iterations!
8 took 3 iterations!
9 took 19 iterations!
10 took 6 iterations!
Max iterations (19) by number 9!