#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int MOD2 = 998'244'353;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10L;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){a = b; return true;}
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){a = b; return true;}
    return false;
}
template<class T, class S> inline bool exist(std::set<T> &s, const S &e){
    return (s.find(e) != std::end(s));
}










int main(){
    int L, R; std::cin >> L >> R;
    
    long long ans{};
    std::vector<long long> cnt(R+1, 0);
    for(int g{R}; g >= 2; --g){
        long long k{R/g - (L-1)/g}, c{k * k};
        for(int i{2*g}; i <= R; i += g){
            c -= cnt[i];
        }
        cnt[g] = c;
        if(std::max(2, L) <= g && g <= R){
            c -= 2 * k - 1;
        }
        ans += c;
    }
    std::cout << ans << std::endl;
    return 0;
}

#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
ll phi[1010000];
void EULERinit()
{
    ll top=1000000;
    for(int i=2;i<=top;++i)phi[i]=i;
    for(int i=2;i<=top;++i)
    {
        if(phi[i]==i)for(int j=i;j<=top;j+=i)phi[j]-=phi[j]/i;
        phi[i]+=phi[i-1];
    }
}

ll f1(ll l,ll r){
    ll ans=0;
        for(int i=l;i<=r;i++){
            for(int j=l;j<=r;j++){
                ll gcd=__gcd(i,j);
                if(gcd!=1&&gcd!=i&&gcd!=j) ans++;
            }
        }return ans;
}

ll f(ll n){
    if(n==0) return 0;
    ll sum=n*n,cnt=0;
    for(ll i=2;i<=n;i++){
        cnt+=(n/i-1)*2+1;
    }
    return sum-cnt-phi[n]*2-1;
}


const int MAXN = 1000000+10;



ll cnt[MAXN];
ll mu[MAXN],prime[MAXN];
ll num[MAXN];
bool vis[MAXN];
int pcnt;

/*求解Mobinus函数*/
void Mobinus()
{
    memset(vis,0,sizeof(vis));
    pcnt=0;
    mu[1]=1;
    for(int i=2;i<MAXN;i++){
        if(!vis[i]){
            prime[pcnt++]=i;
            mu[i]=-1;
        }
        for(int j=0;j<pcnt&&i*prime[j]<MAXN;j++){
            vis[i*prime[j]]=1;
            if(i%prime[j])mu[i*prime[j]]=-mu[i];//i是素数的情况
            else {
                mu[i*prime[j]]=0;
                break;
            }
        }
    }
}

ll Main(ll l,ll r)
{
    Mobinus();
    int n=r-l+1;
    ll Max=-99999999,ans=0;
    ll a[MAXN];
    memset(cnt,0,sizeof(cnt));
    memset(num,0,sizeof(num));
    for(int i=0;i<n;i++){
        a[i]=l+i;
        Max=max(a[i],Max);
    }
    for(int i=0;i<n;i++){
        num[a[i]]++;
    }
    for(int i=1;i<=Max;i++){
        for(int j=i;j<=Max;j+=i)
            cnt[i]+=num[j];
    }
    for(int i=1;i<=Max;i++){
        ans+=(mu[i]*cnt[i]*(cnt[i]-1))>>1;
    }
   return ans;
}

ll ff(ll l,ll r){
    ll sum=(r-l+1)*(r-l+1);
    ll cnt=0;
    for(ll i=max(2LL,l);i<=r;i++){
        cnt+=(r/i-1)*2+1;
    }
    //cout<<sum<<" "<<cnt<<" "<<Main(l,r)<<" "<<phi[r]<<endl;
    if(l>1) return sum-cnt-Main(l,r)*2;
    else return sum-cnt-phi[r]*2-1;
}
int main() {
    ll l,r;
    EULERinit();
    cin>>l>>r;
        //cout<< f(r) - f(l - 1)<<endl;
        cout << ff(l,r)<< endl;
        //cout << f1(l,r) << endl;
    //cout<<f(l-1)<<endl;
    return 0;
}
