#include <bits/stdc++.h>
using namespace std;
vector<int> criba(1e6 + 7, 0);
vector<int> primoshasta(1e6 + 7, 0);
int a, b, k;
bool funciona(int l) {
  for (int i = a; i + l - 1 <= b; ++i) {
    if ((primoshasta[i + l - 1] - primoshasta[i - 1]) < k) {
      return false;
    }
  }
  return true;
}
int main() {
  criba[0] = 1;
  criba[1] = 1;
  criba[2] = 0;
  for (int i = 2; i < criba.size(); ++i) {
    primoshasta[i] = primoshasta[i - 1];
    if (criba[i] == 0) {
      primoshasta[i]++;
      for (int j = 2; j * i < criba.size(); ++j) {
        criba[j * i] = 1;
      }
    }
  }
  cin >> a >> b >> k;
  int izq = 1;
  int der = b - a + 1;
  while (izq < der) {
    int mid = (izq + der) / 2;
    if (funciona(mid))
      der = mid;
    else
      izq = mid + 1;
  }
  if (funciona(izq) && izq <= b - a + 1)
    cout << izq;
  else
    cout << -1;
}
