#include <bits/stdc++.h>
using namespace std;
int A, B, K, Cnt[1 << 20];
bool Prime[1 << 20];
vector<int> Primes;
int main(void) {
  for (int i = 2; i <= 1000000; i++) {
    Cnt[i] = Cnt[i - 1];
    if (Prime[i]) continue;
    for (int j = i; j <= 1000000; j += i) Prime[j] = true;
    Primes.push_back(i);
    Cnt[i]++;
  }
  scanf("%d %d %d", &A, &B, &K);
  if (Cnt[B] - Cnt[A - 1] < K) {
    puts("-1");
    return 0;
  }
  int L = 1, R = B - A + 1, Sol = R;
  while (L <= R) {
    int M = (L + R) >> 1;
    bool Ok = true;
    for (int i = A; i + M - 1 <= B; i++)
      Ok &= (Cnt[i + M - 1] - Cnt[i - 1] >= K);
    if (Ok) {
      if (M < Sol) Sol = M;
      R = M - 1;
    } else
      L = M + 1;
  }
  printf("%d\n", Sol);
  return 0;
}
