You are viewing a single comment's thread. Return to all comments →
def superDigit(n, k): # Calculate the initial sum for the repeated number num = str(sum(map(int, str(n))) * k)
# Define the helper function for finding the super digit while len(num) > 1: num = str(sum(map(int, num))) return int(num)
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 →
def superDigit(n, k): # Calculate the initial sum for the repeated number num = str(sum(map(int, str(n))) * k)