先上一张核心算法的图
#include<bits/stdc++.h>
using namespace std;
const int N = 50000;
typedef long long ll;
const int mod = 1e9+7;
int st[N];
int main()
{
int t;
cin>>t;
int n;
unordered_map<int,int> primes;
while(t--)
{
cin>>n;
for(int i=2;i<=n/i;i++)
{
while(n%i==0)
{
n/=i;
primes[i]++;
}
}
if(n>1)
primes[n]++;
}
ll res = 1;
for(auto prime : primes)
{
int p = prime.first, a = prime.second;
ll t = 1;
while(a--)t = (t * p + 1)%mod;
res = res * t %mod;
}
cout<<res<<endl;
return 0;
}