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

#define for0(i, n) for (int i = 0; i < (int)(n); i++)
#define for1(i, n) for (int i = 1; i <= (int)(n); i++)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i)
#define deb(x) cout << #x << "=" << x << endl
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(x) for(auto it = x.begin(); it != x.end(); it++)
#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printclock cerr<< "Time : "<< 1000*(ld) clock()/(ld)CLOCKS_PER_SEC<< "ms\n";
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define inf 1e18
#define mod 1e9 + 7

void dk_98() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

long long lpf[1000001], mobius[1000001];
void least_prime_factor()
{
    for (long long i = 2; i <= 1000000; i++)
        if (!lpf[i])
            for (long long j = i; j <= 1000000; j += i)
                if (!lpf[j]) lpf[j] = i;
}
void Mobius()
{
    for (long long i = 1; i <= 1000000; i++) {
        if (i == 1)
            mobius[i] = 1;
        else {
            if (lpf[i / lpf[i]] == lpf[i])
                mobius[i] = 0;
            else
                mobius[i] = -1 * mobius[i / lpf[i]];
        }
    }
}
long long gcd_pairs(long long a[], long long n)
{
    long long maxi = 0;
    long long fre[1000001] = { 0 };
    for (long long i = 0; i < n; i++) {
        fre[a[i]]++;
        maxi = max(a[i], maxi);
    }
    least_prime_factor();
    Mobius();
    long long ans = 0;
    for (long long i = 1; i <= maxi; i++) {
        if (!mobius[i])
            continue;
        long long temp = 0;
        for (long long j = i; j <= maxi; j += i)
            temp += fre[j];
        ans += temp * (temp - 1) / 2 * mobius[i];
    }
    return ans;
}

void solve() {
    long long l, r; cin >> l >> r;
    long long a[r - l + 1];
    for (long long i = l; i <= r; i++) a[i - l] = i;
    long long val = gcd_pairs(a, r - l + 1);
    val *= 2;
    long long n = r - l + 1;
    long long total = n * n - n;
    total -= val;
    for (long long i = l; i <= r; i++) {
        if (i == 1) continue;
        long long what = r / i;
        total -= (what - 1) * 2;
    }
    cout << total << '\n';
}

int main() {
    fast;
    dk_98();
    int t = 1; //cin >> t;
    while (t--) {
        solve();
    }
}
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<iomanip>
#include<regex>
using namespace std;
#define int long long
const int mod=1e9+7;
bool pri[1000001],squf[1000001],even[1000001];
signed main(){
	int l,r;
	cin>>l>>r;
	for(int i=2;i<=r;i++)
		pri[i]=squf[i]=even[i]=1;
	for(int i=2;i<=r;i++){
		if(!pri[i])
			continue;
		for(int j=i;j<=r;j+=i){
			if(j!=i)
				pri[j]=0;
			even[j]=!even[j];
		}
		for(int j=i*i;j<=r;j+=i*i)
			squf[j]=0;
	}
	int ans1=0,ans2=0;
	for(int g=2;g<=r;g++){
		if(!squf[g])
			continue;
		int a=r/g-(l-1)/g;
		a=a*(a-1)/2;
		if(even[g])
			ans1-=a;
		else
			ans1+=a;
	}
	for(int g=max(2ll,l);g<=r;g++)
		ans2+=r/g-1;
	cout<<(ans1-ans2)*2<<endl;
}