#include <bits/stdc++.h>
const int MAX = 1000005;
using namespace std;
bool primes[MAX];
int prefixsum[MAX];
void fillPrimes() {
  for (int i = 0; i < MAX; ++i) {
    primes[i] = true;
  }
  primes[0] = primes[1] = false;
  for (int i = 2; i * i + 1 < MAX; ++i) {
    if (!primes[i]) continue;
    for (int j = 2 * i; j < MAX; j += i) {
      primes[j] = false;
    }
  }
}
inline int howMany(int x, int y) { return prefixsum[y] - prefixsum[x - 1]; }
int main() {
  fillPrimes();
  int a, b, k;
  scanf("%d %d %d", &a, &b, &k);
  prefixsum[a - 1] = 0;
  for (int i = a; i <= b; ++i) {
    prefixsum[i] = prefixsum[i - 1];
    if (primes[i]) prefixsum[i]++;
  }
  int min = 1;
  int max = b - a + 2;
  if (howMany(a, b) < k) {
    printf("-1");
  } else {
    while (min != max - 1) {
      bool ok = true;
      int middle = (max + min - 1) / 2;
      for (int i = a; i <= b - middle + 1; ++i) {
        if (howMany(i, i + middle - 1) < k) {
          ok = false;
          break;
        }
      }
      if (ok)
        max = middle + 1;
      else
        min = middle + 1;
    }
    printf("%d", min);
  }
}
