//Think simple yet elegant.
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll  long long
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define REP(i,n) for(int i=0;i<n;i++)
#define deb(...) [](const auto&...x){ char c='='; cerr<<#__VA_ARGS__<<" "; ((cerr<<exchange(c,',')<<" "<<x),...); cerr<<"\n"; }(__VA_ARGS__);
const int mx = 1e6+10;
const int INF = 1e9;
vector<int> mu(mx+10);
#define N 1000010
 
ll lpf[N], mobius[N];
 
// Function to calculate least
// prime factor of each number
void least_prime_factor()
{
    for (ll i = 2; i < N; i++)
 
        // If it is a prime number
        if (!lpf[i])
 
            for (ll j = i; j < N; j += i)
 
                // For all multiples which are not
                // visited yet.
                if (!lpf[j])
                    lpf[j] = i;
}
 
// Function to find the value of Mobius function
// for all the numbers from 1 to n
void Mobius()
{
    for (ll i = 1; i < N; i++) {
 
        // If number is one
        if (i == 1)
            mobius[i] = 1;
        else {
 
            // If number has a squared prime factor
            if (lpf[i / lpf[i]] == lpf[i])
                mobius[i] = 0;
 
            // Multiply -1 with the previous number
            else
                mobius[i] = -1 * mobius[i / lpf[i]];
        }
    }
}
 
// Function to find the number of pairs
// such that gcd equals to 1
ll gcd_pairs(ll a[], ll n)
{
    // To store maximum number
    ll maxi = 0;
 
    // To store frequency of each number
    ll fre[N] = { 0 };
 
    // Find frequency and maximum number
    for (ll i = 0; i < n; i++) {
        fre[a[i]]++;
        maxi = max(a[i], maxi);
    }
 
    least_prime_factor();
    Mobius();
 
    // To store number of pairs with gcd equals to 1
    ll ans = 0;
 
    // Traverse through the all possible elements
    for (ll i = 1; i <= maxi; i++) {
        if (!mobius[i])
            continue;
 
        ll temp = 0;
        for (ll j = i; j <= maxi; j += i)
            temp += fre[j];
 
        ans += temp * (temp - 1) / 2 * mobius[i];
    }
 
    // Return the number of pairs
    return ans;
}
void mu_calc(){ 

	for (int i = 1; i <= mx; i++)
        mu[i] = 1;
    for (int i = 2; i*i <= mx; i++)
    {
        if (mu[i] == 1)
        {
            for (int j = i; j <= mx; j += i)
                mu[j] *= -i;
            for (int j = i * i; j <= mx; j += i * i)
                mu[j] = 0;
        }
    }
    for (int i = 2; i <= mx; i++)
    {
        if (mu[i] == i)
            mu[i] = 1;
        else if (mu[i] == -i)
            mu[i] = -1;
        else if (mu[i] < 0)
            mu[i] = 1;
        else if (mu[i] > 0)
            mu[i] = -1;
    }
}


void run_case(){
	ll l,r,d,j,i;
	cin >> l >> r;
	ll c1 = 0,c2 = 0,c3 = 0,a1=0;

	ll a[r-l+1];

	for(d=1;d<=r;++d){
		a1+=mu[d]*(r/d)*(r/d);
	}
	for(i=l;i<=r;i++)
		a[i-l] = i;
	

	c1 = 2LL*gcd_pairs(a,r-l+1);
//	cout<<c1<<" "<<a1<<endl;
	for(i=l;i<=r;++i){
		for(j=i;j<=r;j+=i)
			++c3;
	}
	c3*=2;
	c3-=(r-l+1);
	ll ans = (r-l+1)*(r-l+1) - c1 - c3;
	if(l==1){
		ans+=2*r - 2;
	}
	cout<<ans<<"\n";

}

int main(){
	fast;
	mu_calc();
	int t=1;
	while(t--){
		run_case();
	}
}

//2021.6.19 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
#define res int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
//#define unl __int128
#define eps 5.6e-8
#define RG
#define db double
//#define pc(x) __builtin_popcount(x)
//#define ctz(x) __builtin_ctz(x)
//#define pc(x) __builtin_popcountll(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define ull unsigned LL
#define lowbit(x) (x&-x)
#define gc getchar
#define kcz 998244353
//template <class T>using Tree=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
// }
//inline int read() {
//    res s=0,ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
// char sr[1<<21],z[20];
// int C=-1,Z=0;
// inline void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
// inline void print(res x){
//    if(C>1<<20)Ot();if(x<0)sr[++C]='-',x=-x;
//    while(z[++Z]=x%10+48,x/=10);
//    while(sr[++C]=z[Z],--Z);
// }
inline int read() {
    res s=0,ch=gc(),w=1;
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s*w;
}
inline LL Read() {
    RG LL s=0;
    res ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline void write(RG unl x){
//    if(x>10)write(x/10);
//    putchar(int(x%10)+'0');
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
inline void add(res &x,const res &y){
    x+=y,x>=kcz?x-=kcz:(x<0?x+=kcz:1);
}
inline int Add(const res &x,const res &y){
    return x+y>=kcz?x+y-kcz:(x+y<0?x+y+kcz:x+y);
}
inline int mul(const res &x,const res &y){
    return int(1LL*x*y%kcz);
}
inline int mul(const res &x,const res &y,const res &d){
    return int(1LL*x*y/d%kcz);
}
inline int qpow(res x,res y){
    if(y<=0)return 1;
    res ret=1;
    while(y){
        if(y&1)ret=mul(ret,x);
        x=mul(x,x),y>>=1;
    }
    return ret;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//clock_t start=clock();
//inline void ck(){
//    if(1.0*(clock()-start)/CLOCKS_PER_SEC>0.1)exit(0);
//}
//2021.6.19 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
const int N=1e6+10;
namespace MAIN{
    int cnt[N],vis[N];
    inline void MAIN(){
        res L=max(2,read()),R=read();
        RG LL ans=0;
        for(res i=2;i<=N-10;i++){
            if(!vis[i]){
                for(res j=i;j<=N-10;j+=i)cnt[j]++,vis[j]=(vis[j]==-1?-1:1);
                if(1ll*i*i<=N-10)for(res sz=i*i,j=sz;j<=N-10;j+=sz)vis[j]=-1;
            }
        }
        for(res i=2;i<=R;i++){
            if(vis[i]==-1)continue;
            res t=R/i-(L-1)/i;
            if(cnt[i]&1)ans+=1ll*t*(t-1)/2;
            else ans-=1ll*t*(t-1)/2;
        }
        for(res i=L;i<=R;i++)ans-=R/i-1;
        printf("%lld\n",ans<<1);
//        for(res i=2;i<=N-10;i++){
//            if(!vis[i])prime[++tot]=i;
//            for(res j=1;j<=tot&&i*prime[j]<=N-10;j++){
//                vis[i*prime[j]]=1;
//                if(i%prime[j]==0)break;
//            }
//        }
    }
}
int main(){
//    srand(19260817);
    // freopen("tracing.in","r",stdin);
    // freopen("tracing.out","w",stdout);
    MAIN::MAIN();
//    Ot();
    return 0;
}