#include <bits/stdc++.h>
using namespace std;
void solveA() {
  int a, b, k;
  cin >> a >> b >> k;
  long long n = b;
  vector<bool> isPrime(n + 1, true);
  isPrime[0] = false;
  isPrime[1] = false;
  vector<int> primes;
  for (long long i = 2; i <= n; ++i) {
    if (isPrime[i]) {
      if (i >= a) primes.push_back(i);
      for (long long j = i * i; j <= n; j += i) {
        isPrime[j] = false;
      }
    }
  }
  int curP = 0;
  int limit = -1;
  int maxL = -1;
  for (int i = a; i <= b; ++i) {
    if (curP + k > primes.size()) {
      limit = b - (i - 1) + 1;
      break;
    }
    if (maxL == -1 || maxL < primes[curP + k - 1] - i + 1)
      maxL = primes[curP + k - 1] - i + 1;
    if (i == primes[curP]) curP++;
  }
  if (maxL == -1)
    cout << "-1" << endl;
  else
    cout << max(maxL, limit) << endl;
}
int main() { solveA(); }
