#include <bits/stdc++.h>
using namespace std;
long long int is_prime[1000500];
int main() {
  for (long long int i = 0; i < ((long long int)(1000500)); ++i)
    if (2 <= i) is_prime[i] = true;
  for (long long int i = 2; i * i < 1000500; i++) {
    if (!is_prime[i]) continue;
    for (long long int j = i * i; j < 1000500; j += i) is_prime[j] = false;
  }
  long long int a, b, k;
  cin >> a >> b >> k;
  queue<long long int> q;
  long long int res = -1;
  q.push(a - 1);
  for (long long int pos = a; pos <= b; pos++) {
    if (is_prime[pos]) q.push(pos);
    while (k < ((long long int)(q).size())) q.pop();
    if (((long long int)(q).size()) == k) res = max(res, pos - q.front() + 1);
  }
  if (q.front() == a - 1)
    cout << -1 << endl;
  else
    cout << res << endl;
}
