題意:給定n,求1/x+1/y=1/n!的正整數解的數量
先對原式分解一下
(x+y)/xy=1/n!
xy-(x+y)*n!=0
(n!)^2+xy-(x+y)*n!=(n!)^2
(x-n!)*(y-n!)=(n!)^2
因爲x,y爲任意正整數,所以x-n!和y-n!也可以是任意正整數
所以題意轉化爲->x*y=(n!)^2
那麼我們對n!分解質因數
然後我們考慮x的取值,顯然,若一個質數p有k個,那麼x可以取p^0,p^1....p^k
共(k+1)種情況
乘法原理乘起來就可以了
而且顯然,x確定後,y必然也會被確定
CODE:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <cstring>
#include <ctime>
#include <vector>
#define inf 1e9
#define ll long long
#define For(i,j,k) for(ll i=j;i<=k;i++)
#define Dow(i,j,k) for(ll i=k;i>=j;i--)
using namespace std;
inline void read(ll &tx){ ll x=0,f=1;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();} tx=x*f; }
inline void write(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10); putchar(x%10+'0'); }
inline void writeln(ll x){write(x);puts("");}
using namespace std;
ll n,ans,cnt[3000001],last[3000001],pri[3000001],tot;
ll mo=1e9+7;
bool bj[3000001];
inline void get_pri()
{
For(i,2,n)
{
if(!bj[i]){pri[++tot]=i;last[i]=tot;}
For(j,1,tot)
{
if(i*pri[j]>n) break;
bj[i*pri[j]]=1;
last[i*pri[j]]=j;
if(i%pri[j]==0) break;
}
}
}
inline void fj(ll x)
{
while(x!=1)
{
cnt[last[x]]++;cnt[last[x]]%=mo;
x/=pri[last[x]];
}
}
int main()
{
read(n);
get_pri();
For(i,2,n)
fj(i);
For(i,1,tot) cnt[i]*=2LL,cnt[i]%=mo;
ans=1;
For(i,1,tot)
ans=ans*(cnt[i]+1)%mo;
writeln(ans);
system("pause");
}