#include<bits/stdc++.h>
using namespace std;
void __print(int x){cout<<x;}void __print(long x){cout<<x;}
void __print(long long x){cout<<x;}void __print(unsigned x){cout<<x;}
void __print(unsigned long x){cout<<x;}void __print(unsigned long long x){cout<<x;}
void __print(float x){cout<<x;}void __print(double x){cout<<x;}
void __print(long double x){cout<<x;}void __print(char x){cout<<'\''<<x<<'\'';}
void __print(const char *x){cout<<'\"'<<x<<'\"';}void __print(const string &x){cout<<'\"'<<x<<'\"';}
void __print(bool x) {cout<<(x?"true":"false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
           
#define lp(i,a,b)       for (int i=a;i<=b;i++)
#define rp(i,a,b)       for (int i=a;i>=b;i--)
#define ms(a,x)         memset(a,x,sizeof a)
#define int             long long 
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd((a),(b))
#define lcm(a,b)        (((a)*(b))/(gcd(a,b)))
#define sq(a)           ((a)*(a))
#define sz(a)           (int) a.size()
#define mod             998244353
#define PI              (2*acos(0.0))

const int N=1e6+5;
int cnt[N],A[N],ex[N];

void solve()
{
  int l,r;
  cin>>l>>r;
  lp(i,l,r)
    cnt[i]++;
  for(int i=1;i<N;i++)
  {
    int sum=0;
    for(int j=i;j<N;j+=i)
    {
      sum=(sum+cnt[j]);
    }
    A[i]=sum;
  }
  int now=r-l+1;
  int ans=(now*(now-1));
  for(int i=N-1;i>=1;i--)
  {
    ex[i]=(A[i]*(A[i]-1));
    //if(ex[i]>0)
    {
    for(int j=i+i;j<N;j+=i)
      ex[i]=(ex[i]-ex[j]);
    }
  }
  ans-=ex[1];
  if(l==1) l++;
  lp(i,l,r)
  {
    for(int j=i+i;j<=r;j+=i)
      ans-=2;
  }
  cout<<ans;
}

signed main()
{
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL); cout.tie(NULL);
  int T=1;
  //cin>>T;
  while(T--) solve();
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Vi = vector<ll>;
int main () {
  int L, R;
  cin >> L >> R;
  Vi num(R + 10, 0);
  bool db[1000100];
  for (int i = 0; i <= R; i ++) {
    db[i] = true;
  }
  ll ans = 0;
  for (int i = 2; i <= R; i ++) {
    if (db[i]) {
      ll kj = (R / i) - ((L - 1) / i);
      kj = kj * (kj - 1);
      kj /= 2;
      ll x = 1;
      if (num[i] > 0 && num[i] % 2 == 0) x = -1;
      ans += kj * x;
    }
    if (num[i] == 0) {
      //cout << i << endl;
      for (int j = 2; j * i <= R; j ++) {
        num[i * j] ++;
      }
      if (i <= 1010) {
        for (int j = 1; j * i * i <= R; j ++) {
          db[i * i * j] = false;
        }
      }
    }
    //cout << i << ' ' << ans << endl;
  }
  //cout << ans << endl;
  for (int i = max(2, L); i <= R; i ++) {
    ans -= R / i;
    ans ++;
  }
  cout << ans * 2 << endl;
}