#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb emplace_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 1e6 + 5;
LL res[MAXN];

int main(){
	int l,r;scanf("%d%d",&l,&r);
	LL ans = 0;
	FOR(g,2,r){
		int len = r/g - (l-1)/g;
		res[g] = 1ll*len*len;
	}
	ROF(i,r,2){
		for(int j = i+i;j <= r;j += i) res[i] -= res[j];
	}
	FOR(i,2,r) ans += res[i];
	FOR(g,l,r){
		if(g == 1) continue;
		ans -= 2*(r/g) - 1;
	}
	printf("%lld\n",ans);
	return 0;
}
// gcd = i 的数的个数

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

#define N 1000001
#define int1 long long int

int1 lpf[N], mobius[N];

void least_prime_factor()
{
	for (int1 i = 2; i < N; i++)
		if (!lpf[i])
			for (int1 j = i; j < N; j += i)
				if (!lpf[j])		lpf[j] = i;
}

void Mobius()
{
	for (int1 i = 1; i < N; 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]];
		}
	}
}

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

int main()
{
    int1 l , r;
    cin>>l>>r;
    int1 a[r-l+1];
	for(int1 i=0;i<=r-l;i++)   a[i] = i+l;   
	int1 n = r-l+1;

	int1 x = 2*gcd_pairs(a, n);
	int1 total = (r-l)*(r-l+1);
	int1 y = 0;
	
	for(int1 i=0;i<=(r-l)/2;i++) 
	{
	    int1 tmp = a[i];
	    for(int1 j=i+tmp; j<=r-l; j += tmp)   y++;
	}

    if(a[0] == 1)   y -= r-l;
    y *= 2;
	cout<<total-x-y<<endl;

	return 0;
}
