#include <bits/stdc++.h>
using namespace std;
int a, b, k;
bool p[1000009];
int s[1000009];
bool check(int m) {
  for (int i = a; i <= b - m + 1; i++)
    if (s[i + m - 1] - s[i - 1] < k) return false;
  return true;
}
int main() {
  for (int i = 2; i <= 1000000; i++) p[i] = true;
  scanf("%d %d %d", &a, &b, &k);
  for (int i = 2; i <= 1000000; i++) {
    if (p[i])
      for (int j = i + i; j <= 1000000; j += i) p[j] = false;
  }
  for (int i = 1; i <= 1000000; i++) s[i] = s[i - 1] + p[i];
  int lo = 1, hi = b - a + 1 + 1;
  while (lo < hi) {
    int m = (lo + hi) / 2;
    if (!check(m))
      lo = m + 1;
    else
      hi = m;
  }
  if (lo > b - a + 1)
    printf("%d\n", -1);
  else
    printf("%d\n", lo);
  return 0;
}
