Thursday, 19 November 2026
PastThree rungs, one idea. Solving rung 1 counts. Climb as far as you can.
Finding Factors
loops + factors
List the factors
Write a function called list_factors
A factor of n is a number that divides into n exactly, with nothing left over. Return a list of all the factors of n, smallest first. The number 12 gives [1, 2, 3, 4, 6, 12]. The number n is always 1 or more.
Examples
| Input | Output |
|---|---|
| 12 | [1, 2, 3, 4, 6, 12] |
| 1 | [1] |
| 7 | [1, 7] |
| 16 | [1, 2, 4, 8, 16] |
There are extra hidden tests, so make it work in general, not just for these.
Is it prime
Write a function called is_prime
A prime number has exactly two factors: 1 and itself. Return True if n is prime and False if it is not. 7 is prime, but 8 is not because 2 goes into it. The number 1 has only one factor, so it is not prime. The number n is always 1 or more.
Examples
| Input | Output |
|---|---|
| 7 | True |
| 8 | False |
| 1 | False |
| 2 | True |
There are extra hidden tests, so make it work in general, not just for these.
The biggest shared factor
Write a function called biggest_shared
Return the biggest number that is a factor of both a and b. For 12 and 18, the factors of 12 are 1, 2, 3, 4, 6 and 12, and the factors of 18 are 1, 2, 3, 6, 9 and 18, so the biggest one they share is 6. Both numbers are always 1 or more, and either one may be the bigger. Two numbers that share nothing else still share 1.
Examples
| Input | Output |
|---|---|
| 12, 18 | 6 |
| 7, 5 | 1 |
| 10, 10 | 10 |
| 1, 9 | 1 |
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.