思路:https://blog.csdn.net/queque_heiya/article/details/105947772
直接上模板即可;
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long LL;
const LL maxa=5e6+10;
LL euler[maxa];
void euler_deal(){//O(max_n)时间内筛出欧拉函数值的表 for(int i=0;i<maxa;i++) euler[i]=i;for(int i=2;i<maxa;i++)if(euler[i]==i)for(int j=i;j<maxa;j+=i) euler[j]=euler[j]/i*(i-1);
}
LL euler_deall(LL n){LL res=n;for(int i=2;i*i<=n;i++){if(n%i==0){res=res/i*(i-1);for(;n%i==0;n/=i);}}if(n!=1) res=res/n*(n-1);return res;
}
int main(){LL L,R;euler_deal();scanf("%lld%lld",&L,&R);LL minL=L,ans;for(LL i=L;i<=R;i++){if(euler[i]<minL) minL=euler[i],ans=i;}printf("%lld\n", ans);
}