//~ author      : Sumit Prajapati
#include <bits/stdc++.h>
using namespace std;


#define ull                 unsigned long long
#define ll                  long long
#define int                 long long           
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pb                  push_back
#define mk                  make_pair
#define ff                  first
#define ss                  second
#define all(a)              a.begin(),a.end()
#define trav(x,v)           for(auto &x:v)
#define rep(i,n)            for(int i=0;i<n;i++)
#define repe(i,n)           for(int i=1;i<=n;i++)
#define read(a,n)           rep(i,n)cin>>a[i]
#define reade(a,n)          repe(i,n)cin>>a[i]
#define FOR(i,a,b)          for(int i=a;i<=b;i++)
#define printar(a,s,e)      FOR(i,s,e)cout<<a[i]<<" ";cout<<'\n'
#define curtime             chrono::high_resolution_clock::now()
#define timedif(start,end)  chrono::duration_cast<chrono::nanoseconds>(end - start).count()




auto time0 = curtime;
const int MD=1e9+7;
const int MDL=998244353;
const int INF=1e9;
const int MX=1e6+2;

int LPF[MX];
int mobius[MX];
int ffR[MX];
int ffL[MX];
int l,r;

void init(){
   for (int i = 2; i < MX; i++)
 
        // If it is a prime number
        if (!LPF[i])
 
            for (int j = i; j < MX; j += i)
 
                // For all multiples which are not
                // visited yet.
                if (!LPF[j])
                    LPF[j] = i;

    mobius[1]=1LL;
    for (int i = 2LL; i < MX; i++) {
        if (LPF[i / LPF[i]] == LPF[i])
            mobius[i] = 0;
        else
            mobius[i] = -1LL * mobius[i / LPF[i]];
        
    }
    for(int i=1LL;i<MX;i++)
        for(int j=i;j<MX;j+=i){
            ffR[j]+=(mobius[i]*(r/i));
            ffL[j]+=(mobius[i]*((j-1)/i));
        }

 
}
 

int count(int x){
    int divis=r/x;
    // cout<<divis<<" "
    // 7-(1+1)
    // 7 8 9 10 5-(5+())
    return (r-x+1LL)-(divis+ffR[x]-ffL[x]);
}
 
 
void solve(){
  
    int ans=0;
    cin>>l>>r;
    init();
    for(int x=max(2LL,l);x<=r;x++){
        // cout<<x<<" -> "<<ffL[x]<<" "<<ffR[x]<<" "<<count(x)<<'\n';
        ans+=count(x);
    }
    ans<<=1LL;
    cout<<ans<<'\n';
 
} 
 
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    time0 = curtime;
    srand(time(NULL));
    int t=1;
    // cin>>t;
    repe(tt,t){
        // cout<<"Case #"<<tt<<": ";
        solve();
    }
    
    cerr<<"Execution Time: "<<timedif(time0,curtime)*1e-9<<" sec\n";
    return 0;
 
}
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e6+13;
typedef long long ll;
int p[maxn+13];
ll mu[maxn+13];
int tag[maxn+13];
void pre_mu(){
	mu[1]=1;
	int cnt=0;
	for(int i=2;i<=maxn;i++)
	{
		if(!tag[i]) mu[i]=-1,p[++cnt]=i;
		for(int j=1;j<=cnt&&i*p[j]<=maxn;j++)
		{
			tag[i*p[j]]=1;
			if(i%p[j]==0)
			{
				mu[i*p[j]]=0;
				break;
			}
			mu[i*p[j]]=-mu[i];
		}
	}
	for(int i=1;i<=maxn;i++) mu[i]+=mu[i-1]; 
}
ll cal(int l,int r){
	int j;
	ll sum=0;
	for(int i=1;i<=min(l,r);i=j+1){
		j=min(l/(l/i),r/(r/i));
		sum+=1ll*(mu[j]-mu[i-1])*(l/i)*(r/i);
	}
	return sum;
}
int main(){
	int l,r;
	scanf("%d%d",&l,&r);
	pre_mu();
	ll ans=1ll*(r-l+1)*(r-l+1);
	ans-=(cal(r,r)-2*cal(l-1,r)+cal(l-1,l-1));
	for(int i=l;i<=r;i++){
		if(i==1) continue; 
		ans++;
		for(int j=i;j<=r;j+=i){
			ans-=2;
		}
	}
	printf("%lld",ans);
}