Collatz conjecture solver
Go to file
2024-07-08 08:36:04 -07:00
.gitignore Initial commit 2024-07-07 17:39:59 -07:00
LICENSE Add license (Apache License 2.0) 2024-07-07 20:02:17 -07:00
main.cpp SUPPORT FOR GMP AND NONGMP IN THE SAME BRANCH!!! 2024-07-08 08:36:04 -07:00
Makefile SUPPORT FOR GMP AND NONGMP IN THE SAME BRANCH!!! 2024-07-08 08:36:04 -07:00
nongmp.hpp SUPPORT FOR GMP AND NONGMP IN THE SAME BRANCH!!! 2024-07-08 08:36:04 -07:00
README.md SUPPORT FOR GMP AND NONGMP IN THE SAME BRANCH!!! 2024-07-08 08:36:04 -07:00
TODO.md GMP Support (see description) 2024-07-07 18:54:06 -07:00
withgmp.hpp SUPPORT FOR GMP AND NONGMP IN THE SAME BRANCH!!! 2024-07-08 08:36:04 -07:00

Collatz conjecture solver

(x%2==0) ? x/=2 : x=x*3+1;

Program to solve the 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).

Algorithm:

  • Start with number.
  • If number is even, divide by two.
  • If number is odd, multiply by three and add one.
  • Repeat.