number and a base base.
Write number in base base, then add up the digits of that representation as ordinary decimal values. Return the sum.number=29, base=4 → 5
29 written in base 4 is 131, and 1 + 3 + 1 = 5.
number=15, base=2 → 4
15 in binary is 1111; four ones give 4.
number=81, base=9 → 1
81 in base 9 is 100, whose digits add up to 1.
number ≤ 100base ≤ 10number=29, base=4
5
Run checks the first 3 tests in your browser. Submit checks all 90 tests on the server, hidden ones included.