collatz/README.md

18 lines
736 B
Markdown
Raw Normal View History

2024-07-07 20:39:59 -04:00
# Collatz conjecture solver
### (x%2==0) ? x/=2 : x=x*3+1;
Program to solve the [Collatz conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture).
To build:
- With GMP: Run `make -j1` (any more than `-j1` doesn't really do anything, there's four things to do and they can't be put out of order).
- Without GMP: Run `make gmpless -j1` (see above parenthetical statement).
2024-07-07 20:39:59 -04:00
2024-07-08 12:13:22 -04:00
You can get releases at [here](https://git.sdf.org/ilikecats/collatz/releases), but only GMP releases (except for 1.0), and only for GNU/Linux (except for 1.0).
You have to build without GMP if you don't want to/can't use GMP.
2024-07-07 20:39:59 -04:00
Algorithm:
- Start with number.
- If number is even, divide by two.
- If number is odd, multiply by three and add one.
- Repeat.