題面
題意給出n個a,問LCM{ f(a) },f爲斐波那契數。
記住這兩個路人性質就好
①容斥求LCM
②對多個數也成立
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define mmst(a, b) memset(a, b, sizeof(a))
#define mmcp(a, b) memcpy(a, b, sizeof(b))
typedef long long LL;
const LL mo=1e9+7;
const int N=1010000;
int n;
LL ans=1,f[N],g[N];
bool b[N];
LL cheng(LL a,LL b)
{
LL res=1;
for(;b;b>>=1,a=a*a%mo)
if(b&1)
res=res*a%mo;
return res;
}
int main()
{
g[1]=f[1]=1;
for(int i=2;i<N;i++)
f[i]=(f[i-1]+f[i-2])%mo,g[i]=f[i];
for(int i=2;i<N;i++)
{
LL inv=cheng(g[i],mo-2);
for(int j=i+i;j<N;j+=i)
g[j]=g[j]*inv%mo;
}
cin>>n;
for(int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
b[x]=1;
}
for(int i=1;i<N;i++)
{
bool ok=0;
for(int j=i;j<N;j+=i)
if(b[j])
{
ok=true;
break;
}
if(ok)
ans=ans*g[i]%mo;
}
cout<<ans<<endl;
return 0;
}