#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 5e6 + 5;
long long int gcd(long long int x, long long int y) {
  return x ? gcd(y % x, x) : y;
}
long long int primes[maxn];
void seive() {
  fill(primes, primes + maxn, 1);
  primes[0] = 0;
  primes[1] = 0;
  for (long long int i = 2; i * i < maxn; i++) {
    if (primes[i] == 1)
      for (long long int j = i + i; j < maxn; j += i) {
        primes[j] = 0;
      }
  }
  for (long long int i = 1; i < maxn; i++) {
    primes[i] += primes[i - 1];
  }
}
long long int a, b, k;
long long int check(long long int m) {
  for (long long int bb = a; bb + m - 1 <= b; bb++) {
    long long int ps = primes[bb + m - 1] - primes[bb - 1];
    if (ps < k) {
      return 0;
    }
  }
  return 1;
}
void solve() {
  seive();
  cin >> a >> b >> k;
  long long int ll = 0;
  long long int hl = b - a + 1;
  long long int ans = 0;
  while (hl - ll >= 0) {
    long long int mid = (hl + ll) / 2;
    if (!check(mid)) {
      ll = mid + 1;
    } else {
      ans = mid;
      hl = mid - 1;
    }
  }
  cout << (ans == 0 ? -1 : ans);
}
signed main() { solve(); }
