本来还以为小图灵从洛谷搬的数据,结果不一样
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using lll=__int128;
constexpr unsigned M=107;
long long n;
int m;
vector<int> p;
int d[M];
inline ll qp(ll a,ll b){
ll s=1;
while(b){
if(b&1) s*=a;
a*=a;
b>>=1;
}
return s;
}
inline ll wtcl(ll x,int k){
ll t=pow((long double)x,(long double)1.0/k);
if(qp(t+1,k)==x) return t+1;
return t;
}
ll f[M];
signed main(){
ll ans{0};
scanf("%lld%d",&n,&m);
if(m==1){
printf("%lld\n",n);
return 0;
}
ans=1ll;
for(int i{60};i>=m;--i){
f[i]=wtcl(n,i)-1;
for(int j{2};i*j<=60;++j){
f[i]-=f[i*j];
}
ans+=f[i];
}
printf("%lld",ans);
return 0;
}