#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define pll pair<long long,long long>
#define vl vector<long long>
#define vll vector<pll>
#define vi vector<int>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
using namespace std;
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAXN = 1000002;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;
const ld EPS = 1e-7;
// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define trav(a, x) for(auto& a : x)
#define fill(x,y) memset(x,y,sizeof(x))
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
ll n,m ;
ll mul(ll x, ll y)
{
    return (x * 1ll * y) % m;
}
 
ll fastpow(ll x, ll y)
{
    ll z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}
ll modinv(ll n,ll p)
{
	return fastpow(n,p-2) ;
}
struct Comp {
  bool operator()(const std::pair<int, int> &a, const std::pair<int, int> &b) {
    if (a.first != b.first) {
      return a.first < b.first;
    }
    return a.second >b.second;
  }
};


int main(int argc, char** argv)
{   sws ;
 // cout<<setprecision(10);
//  ll google=0 ; 
  
   // tcase
    {
     ll l,r ;
     cin>>l>>r; 
     ll ans[r+1]={0} ;
     ll val[r+1]={0} ;
     for(int i=r;i>=2;i--)
     {  ll cnt=0,k=0,temp=0 ; ;
     	for(int j=2*i;j<=r;j+=i)
     	{
     		if(j>=l&&j<=r)
     		{
			 
			 k++ ;
			 temp+=val[j] ;
     	    }
     	    cnt+=ans[j] ;
		}
		val[i]=k ;
		ans[i]=(k*(k-1))/2-cnt-temp ;
	//	cout<<ans[i]<<" ";
	 }
	 ll fin=0 ;
	 for(int i=2;i<=r;i++)
	 {
	 fin+=ans[i] ;
// cout<<2*ans[i]<<" ";
	 }
	 cout<<2*fin<<"\n" ;
    }
return 0 ;
}
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define p(x,y) pair<x,y>
#define oset(x) tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define scan(a) for(auto &it:a)cin>>it;
#define print(a) {for(auto it:a)cout<<it<<" ";cout<<endl;}
#define out(x) cout<<((x)?"YES":"NO")<<endl;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define int ll

void solve()
{
    int l,r;
    cin>>l>>r;
    int cnt[r+1]={};//count of distinct prime if more than 1 same prime than INT_MIN
    rep(i,2,r+1)
    {
        if(cnt[i]!=0)
            continue;
        for(ll j=i;j<=r;j+=i)
            cnt[j]++;
        for(ll j=i*i*1LL;j<=r;j+=i*i*1LL)
            cnt[j]=INT_MIN;
    }
    //counting comprime in l,r;
    int copairs=0;//coprime pairs(x,y) where x<y
    rep(i,1,r+1)
    {
        if(cnt[i]<0)
            continue;
        ll mul=(r/i)-((l-1)/i);
        ll pairs=(mul*(mul-1))/2;
        if(cnt[i]%2)
            copairs-=pairs;
        else 
            copairs+=pairs;
    }
    copairs*=2LL;
    int gcdgpairs=0; //(x,y) pairs where k*x=y k>1 
    for(int i=max(l,2LL);i<=r;i++)
        gcdgpairs+=(r/i)-1;
    gcdgpairs*=2LL;
    int equalpairs=r-l+1;
    int ans=(r-l+1)*(r-l+1)-gcdgpairs-copairs-equalpairs;
    cout<<ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t=1;
    //init();
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
