about | help | code help+videos | done | prefs |
Calculate the length of a hailstone sequence starting with n. The hailstone sequence starts at any natural number n (the current number), and the next number is defined as 3n+1 when the current number is odd, or n/2 when n is even, and the stopping condition is always when n = 1. Sample sequences: 8 4 2 1 hailLen(8) -> 4 3 10 5 16 8 4 2 1 hailLen(3) -> 8 hailLen(1) → 1 hailLen(2) → 2 hailLen(3) → 8 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy