AcWing 871. 约数之和 Python
原题链接
简单
作者:
申侠
,
2020-10-28 21:15:59
,
所有人可见
,
阅读 241
n = int(input())
m = {}
def dbs(x):
i = 2
while i <= x/i:
while x % i == 0:
x = int(x/i)
if i not in m:
m[i] = 1
else:
m[i] += 1
i += 1
if x > 1:
if x not in m:
m[x] = 1
else:
m[x] += 1
while n:
x = int(input())
dbs(x)
n -= 1
r = 1
import math
mod = int(1e9 + 7)
for k in m:
t = 1
# for i in range(m[k]+1): 这种原始的方法,当数较大时有Bug 推挤使用秦久韶算法
# l = int (l + math.pow(k,i) % mod)
for i in range(m[k]):
t = t * k + 1
r = r * t
print(int(r%mod))