#include <bits/stdc++.h>
using namespace std;
void debug() {
  fflush(stdin);
  printf("Press any key to continue");
  getc(stdin);
  fflush(stdin);
}
int a, b, k;
int s[10000005];
bool can(int mid) {
  for (int i = a; i + mid - 1 <= b; i++) {
    if (s[i + mid - 1] - s[i - 1] < k) return false;
  }
  return true;
}
int main() {
  for (int i = 2; i <= 1e6; i++) s[i] = 1;
  for (long long i = 2; i * i <= 1e6; i++) {
    if (s[i] == 1) {
      for (long long j = i * 2; j <= 1e6; j += i) s[j] = 0;
    }
  }
  for (int i = 2; i <= 1e6; i++) s[i] += s[i - 1];
  scanf("%d%d%d", &a, &b, &k);
  int l = 1, r = b - a + 1, mid, flag = 1;
  while (l < r) {
    mid = l + (r - l) / 2;
    if (flag = 1 - flag) mid++;
    if (can(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (l <= b && can(l))
    printf("%d\n", l);
  else
    printf("-1\n");
  return 0;
}
