You are viewing a single comment's thread. Return to all comments →
Python 3 solution... Needed a bit of an optimization to avoid memory issue (e.g. the initial_super_digit calculation).
def _super_digit(n): if len(str(n)) == 1: return n return _super_digit(sum([int(c) for c in str(n)])) def superDigit(n, k): initial_super_digit = _super_digit(n) return _super_digit(initial_super_digit * k)
Seems like cookies are disabled on this browser, please enable them to open this website
Super Digit
You are viewing a single comment's thread. Return to all comments →
Python 3 solution... Needed a bit of an optimization to avoid memory issue (e.g. the initial_super_digit calculation).