Skip to content

MontuPanda/Collatz-problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

3x+1

3x+1 recreated in Python

If a number is odd it is multiplied by 3 and 1 is added to the product. If a number is even it is divided by 2.

These rules are applied directly to any positive natural number. All numbers till 2 to the power 62 have been found and all end up at 1.

Since 1 is odd multiplying by 3 and adding 1 becomes 4, dividing by 2 gives 2, and dividing again gives 1, which creates a loop.

This Python code uses Matplotlib to show the graph of any number inputed.

About

3x+1 recreated in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages