Sum Squared Digits Function
Jump to navigation
Jump to search
This problem asks you to convert an input number to a given base and then compute the sum of the squares of the digits.
The only challenge here is to know how to convert bases, and it's not even that hard, since the answer does not need to be constructive...we only need the sum.
- while number is not 0
- ans += (number % base)^2
- ans /= base