You are viewing a single comment's thread. Return to all comments →
Python 3
# Override the built-in sum function def sum(n: str) -> int: s = 0 for i in n: s += int(i) return s def superDigit(n, k): p = sum(n)*k while p >= 10: p = sum(str(p)) return p
Seems like cookies are disabled on this browser, please enable them to open this website
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
Python 3