Complexity
Time:
Space:
Notes
Getting each digit in a number takes time.
Can the number go up to infinity?
A: No. Numbers with 4 or more digits will eventually come down to 3 digits. E.g. will square-sum up to , will be and so on even when we have 13 9s, it’ll be just . So, the numbers will either cycle or come down to 1.