#include <bits/stdc++.h>
using namespace std;
long long prime[1000009], ara[1000009];
long long a, b, k;
void sieve() {
  prime[1] = 1;
  for (long long i = 4; i <= 1000009; i += 2) prime[i] = 1;
  for (long long i = 3; i <= 1009; i++) {
    if (prime[i] == 0) {
      for (long long j = 2; i * j <= 1000009; j++) prime[i * j] = 1;
    }
  }
  prime[2] = 0;
  for (long long i = 1; i <= 1000009; i++) {
    if (prime[i] == 0)
      ara[i] = ara[i - 1] + 1;
    else
      ara[i] = ara[i - 1];
  }
}
long long f(long long l) {
  if (a + l - 1 > b) return -1;
  for (long long x = a; x <= b - l + 1; x++) {
    long long dif = ara[x + l - 1] - ara[x - 1];
    if (dif < k) return -1;
  }
  return 1;
}
int main() {
  sieve();
  scanf("%lld %lld %lld", &a, &b, &k);
  long long low = 1, high = b - a + 1, mid, cnt = 0;
  while (cnt++ < 32) {
    mid = low + (high - low) / 2;
    if (f(mid) >= 1)
      high = mid;
    else
      low = mid;
  }
  if (f(mid - 1) < 0 && f(mid) < 0 && f(mid + 1) < 0) {
    printf("-1\n");
    return 0;
  }
  if (f(mid) < 0) mid++;
  printf("%lld\n", mid);
  return 0;
}
