思路:
(1)由数论基本定理,任何一个正整数x都能写作,其中p1,p2..pk为x的质因子。
(2) 由此可以推断,要求一个数约数的和,注意到约数就是p1,p2...pk的一种组合,实际上就是求这些质因子的所有组合方式的和,每种质因子有()种选择,显然是(
)...(
)种不同组合,将这些组合相加即为约数的和,进行分配律合并即为:
()...(
);
(3)那么先可以进行质因子分解,拿到质因子及其个数后,考虑求取
();显然这相当于pi进制的一个1111...111的数共 (
)项;设t为1,用乘pi加1,循环
次即可得到(
)的值了,以此计算相乘取模即可。
代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 1e9 + 7;
int main()
{
    LL n;
    cin >> n;
    
    unordered_map<int,int> q;
    
    while(n --)
    {
        LL x;
        cin >> x;
        
        for(int i = 2;i <= x/i;i ++)
        {
            while(x % i == 0)
            {
                q[i] ++;
                x /= i;
            }
        }
        
        if(x > 1) q[x] ++;
    }
    
    LL res = 1;
    for(auto t : q)
    {
        LL p = t.first;
        LL e = t.second;
        
        LL tmp = 1;
        while(e --)
        {
            tmp = (tmp*p + 1) % mod;
        }
        
        res = res*tmp %mod;
    }
    
    cout << res << endl;
    
    return 0;
}


















