#include <bits/stdc++.h>
int prime[1000000 + 11];
int num[1000000 + 11];
int a, b, k;
void prime_table() {
  int i, j;
  memset(prime, 0, sizeof(prime));
  memset(num, 0, sizeof(num));
  prime[0] = prime[1] = 1;
  for (i = 2; i <= 1000000; ++i) {
    if (!prime[i]) {
      for (j = i + i; j <= 1000000; j += i) prime[j] = 1;
    }
  }
  prime[0] = prime[1] = 0;
  for (i = 2; i <= 1000000; ++i) {
    if (prime[i])
      prime[i] = 0;
    else
      prime[i] = 1;
    prime[i] += prime[i - 1];
  }
}
int judge(int mid) {
  int i;
  mid -= 1;
  for (i = a; i + mid <= b; ++i) {
    if (prime[i + mid] - prime[i - 1] < k) return 0;
  }
  return 1;
}
int main() {
  prime_table();
  scanf("%d%d%d", &a, &b, &k);
  int l = 1, r = b - a + 1, mid, ans;
  if (prime[b] - prime[a - 1] >= k) {
    while (l <= r) {
      mid = (l + r) >> 1;
      if (judge(mid)) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    printf("%d\n", ans);
  } else
    printf("-1\n");
  return 0;
}
