#include <bits/stdc++.h>
using namespace std;
int a, b, k;
int prime[1000001];
void g_primes() {
  for (int i = 2; i <= 1e6; i++) prime[i] = 1;
  for (int i = 2; i * i <= 1e6; i++) {
    if (prime[i]) {
      for (int j = i + i; j <= 1e6; j += i) prime[j] = 0;
    }
  }
  for (int i = 1; i <= 1e6; i++) prime[i] += prime[i - 1];
}
bool check(int l) {
  for (int i = a; i + l <= b + 1; i++) {
    if (prime[i + l - 1] - prime[i - 1] < k) return false;
  }
  return true;
}
int search_ban() {
  int s = 1;
  int e = b - a + 1;
  int ret = -1;
  while (s <= e) {
    int mid = (e + s) / 2;
    if (check(mid)) {
      e = mid - 1;
      ret = mid;
    } else {
      s = mid + 1;
    }
  }
  return ret;
}
int main() {
  cin >> a >> b >> k;
  g_primes();
  cout << search_ban() << endl;
  return 0;
}
