#include <bits/stdc++.h>
using namespace std;
int power(long long int x, long long int y) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
bool prime_check(long long int n) {
  long long int i, j;
  if (n == 1) {
    return false;
  }
  for (i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
long long int fact(long long int n) {
  long long int prod = 1;
  for (long long int i = 1; i <= n; i++) {
    prod = (prod * i) % 1000000007;
  }
  return prod;
}
bool vowl(char c) {
  return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}
bool prime[1000004];
void sieve() {
  memset(prime, true, sizeof(prime));
  prime[1] = false;
  for (long long int i = 2; i <= 1000000; i++) {
    if (prime[i]) {
      for (long long int j = i * i; j <= 1000000; j += i) prime[j] = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a, b, k, i;
  cin >> a >> b >> k;
  sieve();
  int low = 0;
  int high = b - a + 1;
  int ans = -1;
  while (low <= high) {
    int l = (low + high) / 2;
    int cnt = 0;
    bool flag = true;
    for (int i = a; i <= b; i++) {
      cnt += prime[i];
      if (i - a + 1 > l) cnt -= prime[i - l];
      if (i - a + 1 >= l) {
        if (cnt < k) {
          flag = false;
          break;
        }
      }
    }
    if (flag) {
      high = l - 1;
      ans = l;
    } else
      low = l + 1;
  }
  cout << ans << "\n";
  return 0;
}
