#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int sieve[1000111], cnt[1000111];
void init() {
  sieve[1] = 1;
  for (int i = (2), _b = (1000); i <= _b; i++)
    if (!sieve[i]) {
      int j = i * i;
      while (j <= 1000000) {
        sieve[j] = i;
        j += i;
      }
    }
  cnt[1] = 0;
  for (int i = (2), _b = (1000000); i <= _b; i++) {
    cnt[i] = cnt[i - 1];
    if (sieve[i] == 0) ++cnt[i];
  }
}
int a, b, k;
bool check(int l) {
  for (int x = (a), _b = (b - l + 1); x <= _b; x++) {
    if (cnt[x + l - 1] - cnt[x - 1] < k) return false;
  }
  return true;
}
int main() {
  init();
  while (scanf("%d%d%d", &a, &b, &k) == 3) {
    int res = -1;
    int l = 0, r = b - a + 1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (check(mid)) {
        res = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    printf("%d\n", res);
  }
  return 0;
}
