接上一篇
对于一个数N 总能分解成p1^α1 … pk ^αk
#include<iostream>
#include<unordered_map>
using namespace std;
const int mod = 1e9 + 7;
typedef long long LL;
int main() {
int n;
cin >> n;
unordered_map<int, int>ha;
while (n--) {
int x;
cin >> x;
for (int i = 2; i <= x / i; i++) {
if (x % i == 0) {
while (x % i == 0) {
x /= i;
ha[i]++;
}
}
}
if (x > 1)ha[x]++;
}
LL res = 1;
for (auto item : ha) {
int p = item.first, a = item.second;
LL t = 1;
while (a--) {
t = (t * p + 1) % mod;
}
res = res * t % mod;
}
cout << res << endl;
return 0;
}