Title Description
Transmission Door
The main idea is to find the smallest integer that can divide [1,n] into 100000007. Solving
is actually to ask for the least common multiple in [1,n], least common multiple equals ∏pimax (QI) \prod Pi^{max (QI)}
That is, the product of the maximum power of all the mass factors.
Just beginning to think that the 108 10^8 linear sieve can not be, but the loj of the evaluation machine is faster, all directly do the code
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 100000003
#define MX 10000
#define LL long long
#define P 100000007
using namespace std;
bool Pd[n];
int n,prime[6000000];
int main ()
{
scanf ("%d", &n); LL Ans=1;
for (int i=2;i<=n;i++) {
if (!pd[i]) {
prime[++prime[0]]=i;
LL t=i;
while (t* (LL) i<=n) t*=i;
ans=ans*t%p;
}
for (int j=1;j<=prime[0];j++) {
int k=i*prime[j];
if (k>n) break;
Pd[k]=1;
if (i%prime[j]==0) break;
}
}
printf ("%lld\n", ans);
}