#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class ProperDivisors { public:
	int analyzeInterval(int a, int b, int n) 
	{
		int c = 0;
		for(int k=2; k+k<=a+b; ++k)
			c += cd(a+b, k, n) - cd(a-1, k, n);
		return c;
	}

	int cd(int x, int k, int n)
	{
		LL kn = 1;
		for(int i=0; i<n; ++i)
			if( (kn*=k) > x )
				return x/k - (x>=k ? 1 : 0);
		return x/k - x/kn - (x>=k ? 1 : 0);
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, ProperDivisors().analyzeInterval(a, b, n));}
int main(){

CASE(0)
	int a = 32; 
	int b = 1; 
	int n = 3; 
	int _ = 5; 
END
CASE(1)
	int a = 1; 
	int b = 12; 
	int n = 2; 
	int _ = 8; 
END
CASE(2)
	int a = 1000000; 
	int b = 10000000; 
	int n = 10; 
	int _ = 146066338; 
END
/*
CASE(3)
	int a = ; 
	int b = ; 
	int n = ; 
	int _ = ; 
END
CASE(4)
	int a = ; 
	int b = ; 
	int n = ; 
	int _ = ; 
END
*/
}
// END CUT HERE
