Behold: The Collatz Conjecture Library!

You might have read my post on the Collatz Conjecture. If you didn’t, you can read it with this link. If you read it, you know I talked about a cool problem called the Collatz Conjecture, and also showed you a piece of code I made. Well, I updated the code, into a library of functions meant for calculating numbers on the Collatz Conjecture. I have the Gist right here:

There is a class called Collatz, and inside it 6 methods. The first two are simply for returning variables, nothing cool. The most important method inside it is find_steps, which calculates the amount of steps it takes to get from a certain number to 1. The find_max_steps method sees which number from a range of 1 to the method argument has the most steps. The final method, find_smallest steps, returns the smallest number whose steps are more than itself times the argument.

I’m thinking of posting this as a GitHub project, once I improve it. If you have any suggestions for more methods, or just to increase quality, please write in the comments. Thanks!