#include <bits/stdc++.h>
using namespace std;
bool pr[1000006];
int coun[1000006];
void sieve() {
  int a, b;
  for (a = 3; a <= 1000; a = a + 2) {
    if (!pr[a]) {
      for (b = a * a; b <= 1000000; b = b + a) pr[b] = 1;
    }
  }
  coun[2] = 1;
  for (a = 3; a <= 1000000; a++) {
    coun[a] = coun[a - 1];
    if (pr[a] == 0 && a % 2 == 1) coun[a]++;
  }
}
int k;
bool calc(int i, int j, int l) {
  int a, b;
  for (a = i; a <= j - l + 1; a++) {
    b = coun[a + l - 1] - coun[a - 1];
    if (b < k) return false;
  }
  return true;
}
int main() {
  int a, b, c, d, x, y, z;
  sieve();
  int lo, mid, hi;
  cin >> a >> b >> k;
  lo = 1;
  hi = b - a + 1;
  while (1) {
    if (lo + 1 >= hi) break;
    mid = (lo + hi) / 2;
    if (calc(a, b, mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  if (lo <= (b - a + 1) && calc(a, b, lo) == 1) {
    cout << lo << endl;
    return 0;
  }
  if (lo + 1 <= (b - a + 1) && calc(a, b, lo + 1) == 1) {
    cout << lo + 1 << endl;
    return 0;
  }
  cout << -1 << endl;
  return 0;
}
