#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int a, b, K;
bitset<1000000 + 1> isPrime;
void sieve() {
  isPrime.set();
  isPrime[0] = isPrime[1] = 0;
  for (int i = 2; i < 1000000 + 1; i++) {
    if (!isPrime[i]) continue;
    for (long long j = 1LL * i * i; j < 1000000 + 1; j += i) isPrime[j] = 0;
  }
}
bool isGood(int l) {
  int cur = 0;
  for (int i = a; i < a + l; i++) cur += isPrime[i];
  for (int i = a + l; i <= b; i++) {
    if (cur < K) return false;
    cur -= isPrime[i - l];
    cur += isPrime[i];
  }
  return cur >= K;
}
int main() {
  read_file();
  sieve();
  while (cin >> a >> b >> K) {
    int lo = 1, hi = b - a + 1;
    while (lo != hi) {
      int md = (lo + hi) / 2;
      if (isGood(md))
        hi = md;
      else
        lo = md + 1;
    }
    int ans = isGood(lo) ? lo : -1;
    cout << ans << '\n';
  }
}
