#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
bool is_prime[maxn];
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < maxn; i++)
    if (i >= 2) is_prime[i] = 1;
  for (int i = 2; i * i < maxn; i++) {
    if (!is_prime[i]) continue;
    for (int j = i * i; j < maxn; j += i) is_prime[j] = 0;
  }
  int a, b, k;
  scanf("%d%d%d", &a, &b, &k);
  int ret = -1;
  queue<int> Q;
  Q.push(a - 1);
  for (int pos = a; pos <= b; pos++) {
    if (is_prime[pos]) Q.push(pos);
    if (Q.size() > k) Q.pop();
    if (Q.size() == k) ret = max(ret, pos - Q.front() + 1);
  }
  if (Q.front() == a - 1)
    printf("-1\n");
  else
    printf("%d\n", ret);
  return 0;
}
