def addDigits(self, num):
        """
        Enumerate and find the pattern

        Prove pattern:
        num = a0 * 10^0 + a1*10^1 + a2*10^2 ...
        addDigits(num) = a0 + a1 + a2 ... = num%9

        Formal name: digital root

        :type num:
        :rtype: int
        """
        digit = num % 9
        if digit == 0 and num != 0:
            return 9
        else:
            return digit
dataset/ETHPy150Open algorhythms/LeetCode/258 Add Digits.py/Solution.addDigits/original