• + 0 comments
    def superDigit(n, k):
       # calculate inital n by adding n digits and multiplying it by k
        n = functools.reduce(operator.add,[int(i) for i in str(n)])*k    
        if len(str(n))==1:
           return n 
        return superDigit(int(n),1)