#include <bits/stdc++.h>
using namespace std;
int ar[1000005];
int a, b, k;
int wind(int n) {
  int sum = ar[a];
  int i = a, j = a;
  while (j - a + 1 < n) sum += ar[++j];
  while (j <= b) {
    if (sum < k) return 0;
    sum += ar[++j];
    sum -= ar[i++];
  }
  return 1;
}
int main() {
  fill(ar, ar + 1000005, 1);
  ar[1] = 0;
  ar[0] = 0;
  for (long long int i = 2; i * i < 1000005; i++) {
    if (ar[i]) {
      for (long long int j = i * i; j < 1000005; j += i) ar[j] = 0;
    }
  }
  cin >> a >> b >> k;
  int L = 1, R = b - a + 1;
  while (L < R) {
    int h = (L + R) / 2;
    int w = wind(h);
    if (w)
      R = h;
    else
      L = h + 1;
  }
  if (wind(L))
    cout << L << endl;
  else {
    cout << -1 << endl;
  }
  return 0;
}
