#include <bits/stdc++.h>
int prime_cnt[1000001];
void init_prime(void) {
  int i, j;
  for (i = 2; i < 1000001; ++i) {
    prime_cnt[i] = 1;
  }
  prime_cnt[0] = prime_cnt[1] = 0;
  for (i = 2; i < 1000001; ++i) {
    if (prime_cnt[i]) {
      for (j = 2; j * i < 1000001; ++j) {
        prime_cnt[i * j] = 0;
      }
    }
  }
  for (i = 1; i < 1000001; ++i) {
    prime_cnt[i] += prime_cnt[i - 1];
  }
}
int main(void) {
  int a, b, k, l;
  int j, ans;
  int low, high, mid;
  init_prime();
  scanf("%d %d %d", &a, &b, &k);
  l = b - a + 1;
  low = k;
  high = l;
  ans = -1;
  while (low <= high) {
    mid = (low + high) >> 1;
    for (j = a; j <= b - mid + 1; ++j) {
      if (prime_cnt[j + mid - 1] - prime_cnt[j - 1] < k) {
        break;
      }
    }
    if (j > b - mid + 1) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
