#include <bits/stdc++.h>
using namespace std;
long long int sieve[1000003 + 5];
long long int num_primes[1000005] = {0};
void calc_sieve() {
  for (long long int i = 0; i <= 1000003; i++) sieve[i] = 0;
  sieve[0] = sieve[1] = 1;
  for (long long int i = 2; i <= 1000003; i++) {
    num_primes[i] = num_primes[i - 1];
    if (sieve[i] == 0) {
      num_primes[i]++;
      for (long long int j = i + i; j <= 1000003; j = j + i) sieve[j]++;
    }
  }
}
long long int ans = -1;
bool check(long long int a, long long int b, long long int l, long long int k) {
  for (long long int i = a; i <= b - l + 1; i++) {
    if (num_primes[i + l - 1] - num_primes[i - 1] < k) return false;
  }
  ans = l;
  return true;
}
void binary_search_primes(long long int a, long long int b, long long int k,
                          long long int start, long long int end) {
  if (end - start <= 1) {
    if (!check(a, b, start, k)) check(a, b, end, k);
    return;
  }
  long long int mid = (start + end) / 2;
  if (check(a, b, mid, k)) {
    binary_search_primes(a, b, k, start, mid - 1);
  } else {
    binary_search_primes(a, b, k, mid + 1, end);
  }
}
int main() {
  calc_sieve();
  long long int a, b, k;
  cin >> a >> b >> k;
  binary_search_primes(a, b, k, 1, b - a + 1);
  cout << ans;
  return 0;
}
