https://www.cnblogs.com/peng-ym/p/8666124.html
#include#define LL long long #define ULL unsigned long long #define rep(i,j,k) for(int i=j;i<=k;i++) #define dep(i,j,k) for(int i=k;i>=j;i--) #define INF 0x3f3f3f3f #define mem(i,j) memset(i,j,sizeof(i)) #define make(i,j) make_pair(i,j) #define pb push_back using namespace std; const LL mod=20101009; const int N=1e7+5; int pre[N],tot,k; LL mu[N]; bool vis[N]; void init() { mu[1]=1; rep(i,2,N-5) { if(!vis[i]) { pre[++tot]=i; mu[i]=-1; } for(int j=1;j<=tot&&pre[j]*i<=N-5;j++) { vis[i*pre[j]]=1; if(i%pre[j]==0) break; mu[i*pre[j]]=-mu[i]; } } rep(i,1,N-5) mu[i]=(mu[i-1]+1LL*mu[i]*1LL*i%mod*1LL*i%mod)%mod; } int main() { int n,m; init(); scanf("%d %d",&n,&m); LL ans=0; LL inv2=(mod+1LL)/2LL; rep(d,1,min(n,m)) { int M=m/d; int N=n/d; LL tmp=0LL; for(int l=1,r;l<=min(N,M);l=r+1) { r=min(N/(N/l),M/(M/l)); tmp=(tmp+((mu[r]-mu[l-1])%mod*1LL*(1LL+N/l)%mod*1LL*(N/l)%mod*inv2%mod*(1LL+M/l)%mod*(M/l)%mod*inv2%mod)%mod)%mod; } ans=(ans+tmp*1LL*d%mod)%mod; } printf("%lld\n",(ans+mod)%mod); return 0; }