1-99999各数各位数字之和最终结果再1~9出现比例

1、给定自然数 n,编写函数,求其各位数字之和,如数 1234 各位数字之和为10。编写函数,重复上述过程,直至得到 1~9 之间的某个数。

2、继续上一题。编写函数,检查 1~99999 之间所有数,给出最终结果中1~9 出现比例。

主要希望解答一下第二问(python)

from collections import Counter

def getV(n):
    if 10 > n > 0:
        return n
    else:
        return getV(sum(map(int, list(str(n)))))
    
r = [getV(i) for i in range(1, 100000)]
res = Counter(r)
print(res)