#include <bits/stdc++.h>
using namespace std;
const int M = 1000000 + 5;
vector<int> v;
int a, b, k;
bool puc(int l) {
  for (int first = a; first <= b - l + 1; ++first) {
    if (v[first + l - 1] - v[first - 1] < k) return false;
  }
  return true;
}
int main() {
  vector<char> p(M, 1);
  p[0] = p[1] = 0;
  for (int i = 2; i * i < M; ++i)
    if (p[i])
      for (int j = i + i; j < M; j += i) p[j] = 0;
  v = vector<int>(M, 0);
  for (int i = 1; i < M; ++i) v[i] = v[i - 1] + p[i];
  cin >> a >> b >> k;
  int ans = -1;
  int lo = b - a + 1, hi = 1;
  while (lo - hi > 1) {
    int m = (lo + hi) / 2;
    if (puc(m))
      lo = m;
    else
      hi = m;
  }
  if (!puc(lo))
    cout << -1 << endl;
  else
    cout << lo << endl;
}
