The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half the previous term. Otherwise, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.

The conjecture is named after Lothar Collatz, who introduced the idea in 1937, two years after receiving his doctorate. It is also known as the 3n + 1 conjecture, the Ulam conjecture (after StanisÅ‚aw Ulam), Kakutani's problem (after Shizuo Kakutani), the Thwaites conjecture (after Sir Bryan Thwaites), Hasse's algorithm (after Helmut Hasse), or the Syracuse problem; the sequence of numbers involved is referred to as the hailstone sequence or hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as wondrous numbers.

Paul ErdÅ‘s said about the Collatz conjecture: "Mathematics may not be ready for such problems." He also offered $500 for its solution. Jeffrey Lagarias in 2010 claimed that based only on known information about this problem, "this is an extraordinarily difficult problem, completely out of reach of present day mathematics."

Source Wikipedia

Provided example will generate an array containing every number between the start and end values and calculate the number of steps taken before each number reaches the value of 1 by following the collatz conjecture pattern. When the benchmark is complete, it should render a graph showing how much faster (or slower) the logic ran with each additional thread.

` ````
const operator = function() {
var steps = 0;
var i = 0;
var original;
var x;
for(i = 0; i < params.array.length; i++) {
x = params.array[i];
steps = 0;
original = x;
while (x && x != 1) {
if (x % 2 == 0) {
x = (x / 2);
} else {
x = (x * 3 + 1);
}
steps++;
}
// We know it ran *in order* so just return the steps for max performance
rtn.data.push(steps);
}
};
const params = {
array: [12323,2232,33232,42112,50209,665,712,823,9292,1001],
dataType: 'Int32'
};
hamsters.run(params, operator, function(results) {
console.info(results);
}, function(error) {
console.error(error);
});
```

- Hamsters.js Version:
- Maximum Threads:
- Browser:
- Legacy Mode:
- Atomic Operations Support:
- Transferable Object Support: