#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::string NumberToString(T Number) {
  std::ostringstream ss;
  ss << Number;
  return ss.str();
}
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long ar[1000005], prime[1000005];
void seive() {
  long long i, j, len, count = 0;
  len = sqrt(1000005);
  ar[0] = 1;
  ar[1] = 1;
  for (i = 2; i <= len; i++) {
    if (ar[i] == 0) {
      for (j = i * i; j <= 1000005; j += i) {
        ar[j] = 1;
      }
    }
  }
  for (i = 0; i <= 1000005; i++) {
    if (ar[i] == 0) {
      count++;
    }
    prime[i] = count;
  }
}
long long binary_search(long long a, long long b, long long k) {
  long long low = 1, high = b - a + 1;
  long long ans = -1;
  while (high >= low) {
    long long mid = (high + low) / 2;
    long long x = b - mid + 1;
    int cnt = 0;
    for (int i = a; i <= x; i++) {
      int prm_cnt = prime[i + mid - 1] - prime[i - 1];
      if (prm_cnt >= k) {
        cnt++;
      }
    }
    if (cnt == (x - a) + 1) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return ans;
}
int main() {
  long long a, b, k;
  seive();
  scanf("%lld %lld %lld", &a, &b, &k);
  printf("%lld\n", binary_search(a, b, k));
  return 0;
}
