Hailstorm Numbers   #


<html> <head> <title>Hailstone Numbers</title> </head> <body> <script> var n = 9732100; var sequence = []; function calculateSequence() { var counter = 0; while (true) { sequence[counter] = n; if (n == 1) { break; } if (n % 2 == 0) { n = n / 2; } else { n = 3 * n + 1; } counter++; } } function printSequence() { document.write(sequence + "<br>"); document.write("Sequence Length: " + sequence.length + "<br>"); } calculateSequence(); printSequence(); </script> </body> </html>

Loading Please Wait...