#include <bits/stdc++.h>
using namespace std;
long long a, b, k;
long long prime[1000001];
long long check(long long x) {
  for (long long i = a; i <= b - x + 1; i++) {
    if (prime[i + x - 1] - prime[i - 1] < k) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> a >> b >> k;
  for (long long i = 0; i <= b; i++) prime[i] = 1;
  prime[1] = 0;
  prime[0] = 0;
  for (long long i = 2; i <= b; i++) {
    if (prime[i]) {
      long long ind = i * 2;
      while (ind <= b) {
        prime[ind] = 0;
        ind += i;
      }
    }
  }
  for (long long i = 3; i <= b; i++) prime[i] += prime[i - 1];
  long long l = 1;
  long long r = b - a + 1;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (check(l))
    cout << l;
  else
    cout << -1;
}
