about | help | code help+videos | done | prefs |
The Collatz Conjecture states that given natural numbers (1 or greater) that if a number is even you divide by 2 and if the number is odd, you multiply by THREE and add ONE. You repeat this process until you get to one. Write a program to accept a natural number and count the number of iterations needed to get to ONE. Example 16->8, 8->4, 4->2, 2->1 - by counting the given number the number of steps is 5 CollatzNumbers(1) → 1 CollatzNumbers(2) → 2 CollatzNumbers(4) → 3 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100 Post-solution available
Copyright Nick Parlante 2017 - privacy