#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
using namespace std;
const int N = 1000100;
bool isp[N];
void prep() {
  for (int(i) = (2); (i) < (N); ++(i)) isp[i] = true;
  for (int i = 2; i * i < N; i++)
    if (isp[i])
      for (int j = i * i; j < N; j += i) isp[j] = false;
}
int a, b, k;
bool f(int len) {
  if (len > b - a + 1) return false;
  int np = 0;
  for (int i = 0; i < len; i++) np += isp[a + i];
  if (np < k) return false;
  for (int i = a + len; i <= b; i++) {
    np -= isp[i - len];
    np += isp[i];
    if (np < k) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  prep();
  cin >> a >> b >> k;
  int lo = 1, hi = b - a + 2;
  while (lo != hi) {
    int mi = (lo + hi) / 2;
    if (f(mi))
      hi = mi;
    else
      lo = mi + 1;
  }
  if (lo == 0 || lo > b - a + 1) lo = -1;
  cout << lo << "\n";
  return 0;
}
