Collatz
Details
The Collatz conjecture states that, for any positive integer n, it will eventually reach 1 by repeatedly applying the following procedure:
- If n is even, divide it by 2.
- If n is odd, multiply by 3 and then add 1.
The number of steps needed for n to reach 1 is called its stopping time. For example, the stopping time of 10 is six:
10 → 5 → 16 → 8 → 4 → 2 → 1
Print the stopping times of all the numbers from 1 to 1,000 inclusive, each on their own line.
0 bytes, 0 chars
Restore solutionCompiled from
AT&T syntax to x86-64 Linux. Use
syscalls to write output.
Arturo is an experimental language, no solutions will be saved.
Please leave feedback on the
GitHub issue.
Fennel is an experimental language, no solutions will be saved.
Please leave feedback on the
GitHub issue.
Uiua is an experimental language, no solutions will be saved.
Please leave feedback on the
GitHub issue.
ctrl + enter or