Recursive Digit Sum

  • + 0 comments

    Python one-liner with recursion:

    return n if k == 1 and n < 10 else superDigit(k * sum(int(d) for d in list(str(n))), 1)