#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);}
void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);}
void ioinit() { cout << fixed << setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on

vector<ll> makedivprimes(ll n) {
    vector<ll> divprimes(n + 1, -1);
    vector<bool> isprime(n + 1, true);
    isprime[0] = false;
    isprime[1] = false;
    for (ll i = 2; i <= n; i++) {
        if (isprime[i]) {
            divprimes[i] = i;
            for (ll j = 2 * i; j <= n; j += i) {
                divprimes[j] = i;  // その数をふるい落とした素数を記録
                isprime[j] = false;
            }
        }
    }
    return divprimes;
}
map<ll, ll> prime_factor_fast(ll n, vector<ll>& divprimes) {
    map<ll, ll> result;
    ll ni = n;
    while (ni >= 2) {
        ll p = divprimes[ni];
        if (!result.count(p)) {
            result[p] = 0;
        }
        result[p]++;
        ni = ni / p;
    }
    return result;
}

int main() {
    ioinit();
    ll l, r;
    cin >> l >> r;

    auto divprimes = makedivprimes(1000009);
    ll gans = 0;
    for (ll x = l; x < r; x++) {
        if (x == 1 || divprimes[x] == x) continue;

        ll ans = 0;
        auto pfs = prime_factor_fast(x, divprimes);
        vector<ll> primes;
        for (auto pf : pfs) {
            primes.push_back(pf.first);
        }
        ll m = primes.size();
        for (ll i = 0; i < (1ULL << m); i++) {
            ll usepr = 0;
            ll v = 1;
            for (ll j = 0; j < m; j++) {
                if ((i >> j) & 1) {
                    v *= primes[j];
                    usepr++;
                }
            }
            if (usepr == 0) {
                continue;
            }
            ll sign = 1;
            if (usepr % 2 == 0) {  // 包除原理？
                sign = -1;
            }
            // x+kv<=r;
            // k<=(r-x)/v
            ll k = (r - x) / v;
            for (ll kk = k - 1; kk <= k + 1; kk++) {
                if (x + kk * v <= r) k = kk;
            }
            if (k >= 1) {
                ans += sign * k;
            }
            //perr(x, ans);
        }
        // 最後にxの倍数を除去
        {
            ll k = (r - x) / x;
            for (ll kk = k - 1; kk <= k + 1; kk++) {
                if (x + kk * x <= r) k = kk;
            }
            if (k >= 1) {
                ans -= k;
            }
            //perr(x, ans);
        }
        //perr(x, ans);
        gans += ans;
    }
    print(gans * 2);
}

#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int L, R; cin >> L >> R;

    vector<ll> cnt(R + 1, 0);
    for (int i = R; i >= 2; i--) {
        cnt[i] = R / i - (L - 1) / i;
        cnt[i] *= cnt[i];
        for (int j = i + i; j <= R; j += i) cnt[i] -= cnt[j];
    }

    ll ans = accumulate(ALL(cnt), 0LL);
    REP(i, max(L, 2), R + 1) {
        ans -= 2LL * (R / i - (L - 1) / i);
        ans++;
    }
    cout << ans << endl;
    return 0;
}
