#include <bits/stdc++.h>
using namespace std;
int a, b, k;
int sum = 0;
vector<int> prime(1000010, 1);
void sieve() {
  prime[0] = prime[1] = 0;
  for (int i = 2; i <= b; ++i) {
    if (prime[i]) {
      for (int j = i + i; j <= b; j += i) {
        prime[j] = 0;
      }
    }
  }
}
bool ok(int x) {
  x--;
  for (int i = a; i <= b - x; i++) {
    if (prime[i + x] - prime[i - 1] < k) return false;
  }
  return true;
}
int main() {
  cin >> a >> b >> k;
  sieve();
  for (int i = 2; i <= b; i++) {
    if (prime[i] == 1) sum++;
    prime[i] = sum;
  }
  if (prime[b] - prime[a - 1] < k) {
    cout << "-1";
    return 0;
  }
  int l = b - a + 1, r = 1, mid;
  while (l > r) {
    mid = r + (l - r) / 2;
    if (ok(mid))
      l = mid;
    else
      r = mid + 1;
  }
  cout << r;
}
