#include <bits/stdc++.h>
#define ll long long
#define fo(i,d,c) for(int i=d;i<=c;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int a,b;
const int N=1e7;
ll f[N+1];
void sang_uoc(int n)
{
fo(i,1,n)
{
for(int j=i*2;j<=n;j+=i){
f[j]+=i;
}
}
}
int tinh(int n)
{
if(n!=1){
int tmp=n-1;
fo(i,2,sqrt(n)){
if(n%i==0){
tmp-=(i+n/i);
}
}
int sqrt_n=sqrt(n);
if(sqrt_n*sqrt_n==n){
tmp+=sqrt_n;
}
return abs(tmp);
}
else{
return n;
}
}
ll solve1(){
ll res=0;
fo(i,a,b){
res+=tinh(i);
}
return res;
}
ll solve2()
{
ll res=0;
fo(i,a,b){
res+=abs(i-f[i]);
}
return res;
}
int main()
{
IOS;
cin>>a>>b;
if(b<=1e6){
cout<<(ll)solve1();
}
else{
sang_uoc(N);
cout<<(ll)solve2();
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZm8oaSxkLGMpIGZvcihpbnQgaT1kO2k8PWM7aSsrKQojZGVmaW5lIElPUyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApO2Npbi50aWUoMCk7Y291dC50aWUoMCk7Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGEsYjsKY29uc3QgaW50IE49MWU3OwpsbCBmW04rMV07CnZvaWQgc2FuZ191b2MoaW50IG4pCnsKICAgIGZvKGksMSxuKQogICAgewogICAgICAgIGZvcihpbnQgaj1pKjI7ajw9bjtqKz1pKXsKICAgICAgICAgICAgZltqXSs9aTsKICAgICAgICB9CiAgICB9Cn0KaW50IHRpbmgoaW50IG4pCnsKICAgIGlmKG4hPTEpewogICAgICAgIGludCB0bXA9bi0xOwogICAgICAgIGZvKGksMixzcXJ0KG4pKXsKICAgICAgICAgICAgaWYobiVpPT0wKXsKICAgICAgICAgICAgICAgIHRtcC09KGkrbi9pKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpbnQgc3FydF9uPXNxcnQobik7CiAgICAgICAgaWYoc3FydF9uKnNxcnRfbj09bil7CiAgICAgICAgICAgIHRtcCs9c3FydF9uOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYWJzKHRtcCk7CiAgICB9CiAgICBlbHNlewogICAgICAgIHJldHVybiBuOwogICAgfQp9CmxsIHNvbHZlMSgpewogICAgbGwgcmVzPTA7CiAgICBmbyhpLGEsYil7CiAgICAgICAgcmVzKz10aW5oKGkpOwogICAgfQogICAgcmV0dXJuIHJlczsKfQpsbCBzb2x2ZTIoKQp7CiAgICBsbCByZXM9MDsKICAgIGZvKGksYSxiKXsKICAgICAgICByZXMrPWFicyhpLWZbaV0pOwogICAgfQogICAgcmV0dXJuIHJlczsKfQppbnQgbWFpbigpCnsKICAgIElPUzsKICAgIGNpbj4+YT4+YjsKICAgIGlmKGI8PTFlNil7CiAgICAgICAgY291dDw8KGxsKXNvbHZlMSgpOwogICAgfQogICAgZWxzZXsKICAgICAgICBzYW5nX3VvYyhOKTsKICAgICAgICBjb3V0PDwobGwpc29sdmUyKCk7CiAgICB9CiAgICByZXR1cm4gMDsKfQo=