按照超哥的套路做就可以了。。令p为n的最小素因子
/**
* ┏┓ ┏┓
* ┏┛┗━━━━━━━┛┗━━━┓
* ┃ ┃
* ┃ ━ ┃
* ┃ > < ┃
* ┃ ┃
* ┃... ⌒ ... ┃
* ┃ ┃
* ┗━┓ ┏━┛
* ┃ ┃ Code is far away from bug with the animal protecting
* ┃ ┃ 神兽保佑,代码无bug
* ┃ ┃
* ┃ ┃
* ┃ ┃
* ┃ ┃
* ┃ ┗━━━┓
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,l,r) for(int i=l;i>=r;i--)
#define link(x) for(edge *j=h[x];j;j=j->next)
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
#define eps 1e-12
#define succ(x) (1<<x)
#define lowbit(x) (x&(-x))
#define sqr(x) ((x)*(x))
#define mid (x+y>>1)
#define NM 20000005
#define nm 4105
#define pi 3.1415926535897931
const ll inf=1e9;
using namespace std;
ll read(){
ll x=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
return f*x;
}
int cnt,tot,prime[NM];
ll phi[NM],b[NM],n,m;
bool v[NM];
void init(){
cnt=2e7;phi[1]=1;
inc(i,2,cnt){
if(!v[i])prime[++tot]=i,phi[i]=i-1;
inc(j,1,tot){
if(i*prime[j]>cnt)break;
v[i*prime[j]]++;
if(i%prime[j]==0){phi[i*prime[j]]=phi[i]*prime[j];break;}
phi[i*prime[j]]=phi[i]*(prime[j]-1);
}
}
inc(i,1,cnt)phi[i]+=phi[i-1],phi[i]%=inf;
}
ll sum(__int128 t){return (ll)((t*(t+1)/2)%inf);}
ll PH(ll n){
if(n<=cnt)return phi[n];
int t=m/n;
if(v[t])return b[t];v[t]++;
for(ll i=2,j;i<=n;i=j+1){
j=n/(n/i);
b[t]+=(j-i+1)%inf*PH(n/i)%inf;b[t]%=inf;
}
return b[t]=(sum(n)-b[t]+inf)%inf;
}
ll S(ll n,ll m){
if(m==0)return 0;
if(n==1)return PH(m);
inc(i,1,tot)if(n%prime[i]==0)return ((prime[i]-1)*S(n/prime[i],m)+S(n,m/prime[i]))%inf;
}
int main(){
init();mem(v);
n=510510;m=1e11;
prime[1]=2;prime[2]=3;prime[3]=5;prime[4]=7;prime[5]=11;prime[6]=13;prime[7]=17;
tot=7;
return 0*printf("%lld\n",S(n,m));
}
Let S(n,m) = ∑φ(n × i) for 1 ≤ i ≤ m. (φ is Euler's totient function)
You are given that S(510510,106 )= 45480596821125120.
Find S(510510,1011).
Give the last 9 digits of your answer.