i是什么呢就是积性函数求个前缀和(等差数列)
#include<bits/stdc++.h>
#define N 6000010
using namespace std;
typedef long long ll;
template<typename T>inline void read(T &x)
{
x=0;
static int p;
p=1;
static char c;
c=getchar();
while(!isdigit(c))
{
if(c=='-')p=-1;
c=getchar();
}
while(isdigit(c))
{
x=(x<<1)+(x<<3)+(c-48);
c=getchar();
}
x*=p;
}
int main()
{
ll n,k;
read(n);
read(k);
ll ans=n*k;
for(ll L=1,R=0; L<=n; L=R+1)
{
if(k/L)
R=min(k/(k/L),n);
else
R=n;
ans-=(k/L)*(L+R)*(R-L+1)/2;
}
cout<<ans;
}