#include <bits/stdc++.h>
using namespace std;
long long a, b, k, l, r, m;
int primesCount[1002001 + 1];
bool compositeNumbers[1002001 + 1];
void populatePrimes() {
  compositeNumbers[0] = compositeNumbers[1] = 1;
  for (int i = 2; i <= 1001; i++) {
    if (!compositeNumbers[i]) {
      for (int j = i * i; j <= 1002001; j += i) compositeNumbers[j] = 1;
    }
  }
}
void countPrimes() {
  for (int i = 1; i <= 1002001; i++)
    primesCount[i] = primesCount[i - 1] + !compositeNumbers[i];
}
bool hasPrimes(int l) {
  for (int x = a; x <= b - l + 1; x++) {
    if (primesCount[x + l - 1] - primesCount[x - 1] < k) return 0;
  }
  return true;
}
int main() {
  cin >> a >> b >> k;
  populatePrimes();
  countPrimes();
  l = 1;
  r = b - a + 1;
  while (l < r) {
    m = (l + r) / 2;
    if (hasPrimes(m))
      r = m;
    else
      l = m + 1;
  }
  cout << (hasPrimes(r) ? r : -1) << endl;
  return 0;
}
