#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
bool isprime[N] = {1, 1, 0};
int sum[N] = {};
void YesIcan() {
  for (int i = 2; i * i <= N; ++i) {
    for (int j = i * i; j <= N; j += i) isprime[j] = true;
  }
}
int main() {
  YesIcan();
  int a, b, k;
  cin >> a >> b >> k;
  for (int i = a; i <= b; ++i) {
    sum[i] = sum[i - 1];
    if (!isprime[i]) ++sum[i];
  }
  if (sum[b] < k) {
    cout << -1;
    return 0;
  }
  int i = a - 1, l = 1;
  for (; i <= b - l; ++i) {
    while (sum[i + l] - sum[i] < k && l <= b - a + 1 && i + l <= b) ++l;
  }
  cout << l;
}
