Tuesday, 13 October 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Keep Applying The Rule
while loops + repeating a rule
Double it a few times
Write a function called double_times
Start from start and double it times times, then return the answer. So 3 doubled 2 times is 12. A times of 0 means no doubling at all, so return start unchanged.
Examples
| Input | Output |
|---|---|
| 3, 2 | 12 |
| 1, 3 | 8 |
| 5, 0 | 5 |
| 0, 4 | 0 |
There are extra hidden tests, so make it work in general, not just for these.
How many doublings
Write a function called doubles_to_pass
Now count instead. Keep doubling start until the value is bigger than limit, and return how many doublings that took. start is always 1 or more. If start is already bigger than limit, no doubling is needed, so return 0.
Examples
| Input | Output |
|---|---|
| 1, 10 | 4 |
| 3, 2 | 0 |
| 1, 1 | 1 |
| 5, 100 | 5 |
There are extra hidden tests, so make it work in general, not just for these.
Down to one
Write a function called steps_to_one
Here is a rule with two halves: if the number is even, halve it; if it is odd, multiply it by 3 and add 1. Keep going until the number reaches 1 and return how many times you applied the rule. n is always 1 or more, and an n of 1 is already finished, so return 0. Starting at 3 the numbers go 10, 5, 16, 8, 4, 2, 1 — that is 7 steps.
Examples
| Input | Output |
|---|---|
| 1 | 0 |
| 2 | 1 |
| 3 | 7 |
| 6 | 8 |
There are extra hidden tests, so make it work in general, not just for these.
Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.