#include <bits/stdc++.h>
using namespace std;
int n;
int a, b, k;
bool nt[1000010];
int f[1000010];
void sang() {
  for (int i = 2; i <= b; i++) nt[i] = true;
  for (int i = 2; i <= (int)sqrt(b); i++)
    if (nt[i]) {
      int j = i + i;
      while (j <= b) {
        nt[j] = false;
        j += i;
      }
    }
}
int main() {
  cin >> a >> b >> k;
  sang();
  f[b + 1] = 0;
  for (int i = b; i >= a; i--)
    if (nt[i])
      f[i] = f[i + 1] + 1;
    else
      f[i] = f[i + 1];
  int res = -1;
  int le = 1, ri = b - a + 1;
  while (le <= ri) {
    int mid = (le + ri) / 2;
    bool ok = true;
    for (int x = a; x <= b - mid + 1; x++) {
      if (f[x] - f[x + mid] < k) {
        ok = false;
        break;
      }
    }
    if (ok) {
      res = mid;
      ri = mid - 1;
    } else
      le = mid + 1;
  }
  cout << res;
  return 0;
}
