about | help | code help+videos | done | prefs |
Given a positive integer, recursively apply a step of the Collatz sequence. Each step obeys the following rules: -If the number is even, divide it by 2. -If the number is odd, multiply it by 3 and add 1. Return how many steps it takes to reach the number 1.apcsaRecurCollatz(1) → 0 apcsaRecurCollatz(2) → 1 apcsaRecurCollatz(3) → 7 ...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: 350
Copyright Nick Parlante 2017 - privacy