#include <iostream>
#include <limits>
#include <vector>
#include <algorithm>

using namespace std;
long long count(int x, const vector<int> primes) {
    // {i : i <= x, gcd(i, prod(primes) ) == 1}
    int n = primes.size();
    long long res = 0;
    for (int msk = 0; msk < (1<<n); msk++) {
        int c = 0;
        int y = 1;
        for (int i=0; i < n; i++) {
            if (msk & (1 << i)) {
                c++;
                y *= primes[i];
            }
        }
        if (c % 2 == 0) res += x / y;
        else res -= x / y;
    }
    return res;
}
int main () {
    int L, R;
    cin >> L >> R;

    long long answer = 0;
    for (int x = L; x <= R; x++) {
        if (x == 1) continue;
        vector<pair<long long, long long> > factors;
        vector<int> primes;
        {
        int f = x;
        for (int i = 2; (long long)i * i <= f; i++) {
            if (f % i != 0) continue;
            long long ex = 1;
            while (f % i == 0) {
                f /= i;
                ex *= i;
            }
            factors.push_back({ex, ex/i});
            primes.push_back(i);
        }
        if (f > 1) primes.push_back(f);
        }

        //cerr << x << " " << R << " " << primes.size() << " " << count(R, primes) << endl;
        answer += (long long)(R-x+1) - (count(R, primes) - count(x-1, primes));
        answer -= R / x;
    }
    cout << answer * 2 << endl;
    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;
}
