#include <bits/stdc++.h>
using namespace std;

int main() {
    using ll = long long;
    const ll N = 1e6 + 10;
    ll l, r;
    cin >> l >> r;
    vector<ll> cnt(N, 0);

    ll ans = 0;
    for (ll g = 1e6; g >= 2; g--) {
        ll xk = r / g - (l - 1) / g;
        ll val = xk * xk;
        for (ll i = 2; i * g < N; i++) {
            val -= cnt[i * g];
        }

        cnt[g] = val;

        if (max(2LL, l) <= g and g <= r)
            val -= 2 * xk - 1;

        ans += val;
    }

    cout << ans << endl;
}
#pragma once
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>
using namespace std;

int main() {
    long long l, r;
    cin >> l >> r;
    long long res = 0;
    vector<int> cnt(1048576, 0);
    for (long long i = 2; i <= r; i++) {
        if (cnt[i] != 0) { continue; }
        for (long long j = i; j <= r; j += i) { cnt[j]++; }
        for (long long j = i * i; j <= r; j += i * i) { cnt[j] = -1000000007; }
    }
    for (long long i = 2; i <= r; i++) {
        if (cnt[i] < 0) { continue; }
        long long cc = (r / i) - ((l - 1) / i);
        if (cnt[i] % 2) { res += (cc * (cc - 1)) / 2; }
        else { res -= (cc * (cc - 1)) / 2; }
    }
    for (long long i = max(2ll, l); i <= r; i++) { res -= (r / i - 1); }
    cout << 2 * res << '\n';
    return 0;
}
