UNPKG
theorem.js
Version:
latest (1.2.0)
1.2.0
1.1.0
1.0.1
1.0.0
0.1.0
0.0.2
0.0.1
A Math library for computation in JavaScript
github.com/arguiot/TheoremJS
arguiot/TheoremJS
theorem.js
/
src
/
includes
/
functions
/
math
/
generators
/
collatz.js
11 lines
(10 loc)
•
113 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
*
collatz
(
n
) {
while
(n !=
1
) {
if
(n %
2
==
0
) { n = n /
2
}
else
{ n =
3
* n +
1
}
yield
n; } }