#include <bits/stdc++.h>
using namespace std;
bool nprime[1000 * 1000 + 10];
int cnt[1000 * 1000 + 10];
int main() {
  memset(nprime, 0, sizeof(nprime));
  nprime[0] = nprime[1] = 1;
  int a, b, k;
  cin >> a >> b >> k;
  for (int i = 2; i * i <= b; ++i)
    if (!nprime[i])
      for (int j = i * i; j <= b; j += i) nprime[j] = 1;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < (b + 1); ++i) {
    cnt[i + 1] = cnt[i];
    if (!nprime[i]) ++cnt[i + 1];
  }
  int l = 1, r = b - a + 1;
  while (l < r) {
    int m = (l + r) / 2;
    bool good = true;
    for (int x = a; x <= b - m + 1; ++x) {
      int c = cnt[x + m] - cnt[x];
      if (c < k) {
        good = false;
        break;
      }
    }
    if (good)
      r = m;
    else
      l = m + 1;
  }
  bool good = true;
  for (int x = a; x <= b - l + 1; ++x) {
    int c = cnt[x + l] - cnt[x];
    if (c < k) {
      good = false;
      break;
    }
  }
  if (good)
    cout << l << endl;
  else
    cout << -1 << endl;
  return 0;
}
