Description Usage Arguments Value References Examples
The Collatz conjecture, also known as the 3n + 1 problem, is a currently unsolved problem in number theory that is stated as: Start with a positive integer n If n is even, divide n by 2 If n is odd, multiply by 3 and add 1 to obtain 3n + 1 Repeat this process until the sequence reaches 1. It is unknown if there is a starting integer n that does not result in the sequence ending with 1.
1 | collatz(n)
|
n |
Starting integer to begin 3n + 1 process |
vector containing sequence generated by the Collatz conjecture. If n is 1, 1 is returned.
3x + 1 problem. (2017, May 13). In Wikipedia, The Free Encyclopedia. from https://en.wikipedia.org/wiki/Collatz_conjecture Moler, C. (2011). Numerical computing with MATLAB (1st ed.). Philadelphia, Pa: Society for Industrial & Applied Mathematics.
1 | three_n_one(5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.