【题目链接】 ​点击打开链接​

【题意】中文题面。

【解题方法】

1月2日 51 Node 1189 阶乘分数_#define

Wannafly的题解,然后再次谢谢qwb巨对我的解答疑惑。对了上面的推导还可以参考一下下面的blog里面约数个数和质因子个数的博客:​点击打开链接

【AC代码】

//
//Created by just_sort 2016/1/3
//Copyright (c) 2016 just_sort.All Rights Reserved
//

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <time.h>
#include <cstdlib>
#include <cstring>
#include <sstream> //isstringstream
#include <iostream>
#include <algorithm>
using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef pair<int, LL> pp;
#define REP1(i, a, b) for(int i = a; i < b; i++)
#define REP2(i, a, b) for(int i = a; i <= b; i++)
#define REP3(i, a, b) for(int i = a; i >= b; i--)
#define CLR(a, b) memset(a, b, sizeof(a))
#define MP(x, y) make_pair(x,y)
const int maxn = 1e6 + 10;
const int maxm = 2e5;
const int maxs = 10;
const int maxp = 1e3 + 10;
const int INF = 1e9;
const int UNF = -1e9;
const int mod = 1e9 + 7;
int gcd(int x, int y) {return y == 0 ? x : gcd(y, x % y);}
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>order_set;
//head
int p[maxp], prear;
bool vis[maxn];
int cnt[maxn];
void init(){
for(int i = 2; i < maxp; i++){
if(vis[i]) continue;
p[++prear] = i;
for(int j = 2 * i; j < maxp; j += i){
vis[j] = true;
}
}
}
void solve(int x){
for(int i = 1; x != 1 && i <= prear && (1LL)*p[i] * p[i] <= x; i++){
while(x % p[i] == 0){
cnt[p[i]]++;
x /= p[i];
}
}
if(x != 1) cnt[x]++;
}
LL powmod(LL a, LL n){
LL res = 1;
while(n){
if(n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}

int main()
{
int n;
//clock_t st = clock();
init();
scanf("%d", &n);
for(int i = 1; i <= n; i++) solve(i);
LL ans = 1;
for(int i = 2; i < maxn; i++){
ans *= cnt[i] * 2 + 1;
ans %= mod;
}
ans = (ans + 1) * powmod(2, mod - 2) % mod;
if(ans < 0) ans += mod;
printf("%I64d\n", ans);
//clock_t en = clock();
//printf("%f\n", (en - st) / CLK_TCK);
return 0;
}