Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evanpacini/collatz
C++ and Python programs to analyse the Collatz conjecture.
https://github.com/evanpacini/collatz
collatz collatz-conjecture cpp mathematics maths python python3
Last synced: about 1 month ago
JSON representation
C++ and Python programs to analyse the Collatz conjecture.
- Host: GitHub
- URL: https://github.com/evanpacini/collatz
- Owner: evanpacini
- Created: 2022-04-06T07:47:38.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-06T07:47:45.000Z (almost 3 years ago)
- Last Synced: 2024-12-31T08:31:10.452Z (about 1 month ago)
- Topics: collatz, collatz-conjecture, cpp, mathematics, maths, python, python3
- Language: Python
- Homepage:
- Size: 7.65 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Warning: As of the 6th of April 2022, this readme is not up to date!
# Collatz
Multiple C++ and and Python programs to analyse the Collatz problem.
# Legacy README
## Collatz
C++ program that counts the number of steps to get back to 1 for all numbers up to N and saves it to a csv file.
Python program that imports the csv file and plots the number of steps vs seed using matplotlib.### C++ program versions
- collatzbasic.cpp (the first version I made, just calculates all sequences up to N, and returns the seed with the highest number of steps)
- collatzmem.cpp (the same as the basic one, except it uses memoisation to significantly speed up the process)
- collatzmemopt.cpp (uses memoisation and OpenMP multithreading to speed up, exports results to collatzsteps.csv)
- collatzmemoptbin.cpp (same as previous except for small optimisations such as the use of bitwise operators)Attention: the collatzmemopt.cpp and collatzmemoptbin.cpp require OpenMP to work efficiently... This can be done by using:
- `$ g++ -o collatz -fopenmp collatzmemoptbin.cpp` for GNU-based compilers
- `$ icl -o collatz /MD /Qopenmp collatzmemoptbin.cpp` for Intel compilers### Python program
Will import collatzsteps.csv and plot it with matplotlib. matplotlib and csv libraries are required and can be installed using:
- `$ pip install matplotlib csv`