Description
Input
Output
Sample Input
2
Sample Output
3
HINT
题解
设 z = n ! z=n! z=n!
化简可得
z x x − z = y \frac{zx}{x-z}=y x−zzx=y
显然 x , y x,y x,y均大于 z z z
不妨设 x = z + d x=z+d x=z+d
写为
z 2 d + d = y \frac{z^2}{d}+d=y dz2+d=y
由于 y y y是整数,显然求 z 2 z^2 z2的因数个数
大力线性筛
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
using namespace std;
inline int read()
{
int f=1,x=0;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
inline void write(int x)
{
if(x<0)putchar('-'),x=-x;
if(x>9)write(x/10);
putchar(x%10+'0');
}
inline void print(int x){write(x);printf(" ");}
int pr[1100000],ok[1100000],plen,n;
bool v[1100000];
void getpri(int MAXN)
{
memset(v,true,sizeof(v));ok[1]=1;
for(int i=2;i<=MAXN;i++)
{
if(v[i])pr[++plen]=i,ok[i]=i;
for(int j=1;j<=plen&&i*pr[j]<=MAXN;j++)
{
v[i*pr[j]]=false;ok[i*pr[j]]=min(ok[i],ok[pr[j]]);
if(!(i%pr[j]))break;
}
}
}
LL cnt[1100000];
void calc()
{
for(int i=1;i<=n;i++)
{
int tmp=i;
while(tmp!=1)
{
cnt[ok[tmp]]++;
tmp/=ok[tmp];
}
}
}
int main()
{
getpri(1000000);
n=read();
calc();
LL ans=1;
for(int i=1;i<=n;i++)if(v[i])ans=ans*(2*cnt[i]+1)%mod;
printf("%lld\n",ans);
return 0;
}