| 6 | #include "collatz.hpp" |
| 7 | |
| 8 | void CollatzSolver::step() { |
| 9 | hops++; |
| 10 | if (algo.useOnlyOddNumbers) { |
| 11 | hops++; |
| 12 | } |
| 13 | if (stepNumber % 2 == 0) { |
| 14 | // it is even |
| 15 | stepNumber /= 2; |
| 16 | } else { |
| 17 | // it is odd |
| 18 | stepNumber *= 3; |
| 19 | stepNumber++; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | bool CollatzSolver::solve() { |
| 24 | if (algo.useOnlyOddNumbers && currentNumber % 2 == 0) { |
nothing calls this directly
no outgoing calls
no test coverage detected