n. The following step is applied over and over: factor the number into primes and replace it with the sum of those primes. A prime that divides the number several times is counted that many times (for example, 12 = 2·2·3 becomes 7).
Return the smallest value the number ever takes during the process, the starting value included.n=20 → 5
20 = 2·2·5 → 2+2+5 = 9; 9 = 3·3 → 6; 6 = 2·3 → 5; 5 is prime and maps to itself. The smallest value is 5.
n=4 → 4
4 = 2·2 → 2+2 = 4, so the number never changes and the answer is 4.
n=13 → 13
n=20
5
Run checks the first 3 tests in your browser. Submit checks all 46 tests on the server, hidden ones included.