#include <bits/stdc++.h>
using namespace std;
const int M = (int)1e6 + 5;
int prime[M] = {0};
int Q[M], num[M], n = 0;
inline int chk(int p, int l) {
  int R = p + l - 1;
  int L = p - 1;
  int rc = upper_bound(num, num + n, R) - num;
  int lc = upper_bound(num, num + n, L) - num;
  return rc - lc;
}
int main() {
  for (int i = 2; i * i < M; i++)
    if (!prime[i])
      for (int j = i * 2; j < M; j += i) prime[j] = 1;
  prime[1] = 1;
  for (int i = 2; i < M; i++)
    if (!prime[i]) num[n++] = i;
  int a, b, k;
  cin >> a >> b >> k;
  int l = 1, r = b - a + 2;
  while (r > l) {
    int m = l + r >> 1;
    bool flag = 1;
    int cnt = chk(a, m);
    if (cnt < k)
      flag = 0;
    else {
      for (int i = a + 1; i <= b - m + 1; i++) {
        if (!prime[i - 1]) cnt--;
        if (!prime[i + m - 1]) cnt++;
        if (cnt < k) {
          flag = 0;
          break;
        }
      }
    }
    if (flag)
      r = m;
    else
      l = m + 1;
  }
  cout << (r == b - a + 2 ? -1 : r) << endl;
}
