#include <bits/stdc++.h>
using namespace std;
bool f[1000011];
int a, b, k, i, sum[1000011], j, p[1000011], pn;
int check(int x) {
  for (int i = a; i <= b - x + 1; i++)
    if (sum[i + x - 1] - sum[i - 1] < k) return false;
  return true;
}
int main() {
  scanf("%d%d%d", &a, &b, &k);
  f[1] = true;
  for (i = 2; i <= b + 1; i++) {
    if (!f[i]) p[++pn] = i;
    for (j = 1; j <= pn && p[j] * i <= b + 1; j++) f[p[j] * i] = true;
  }
  for (i = 1; i <= b + 1; i++) sum[i] = sum[i - 1] + int(f[i] == false);
  if (sum[b] - sum[a - 1] < k) {
    printf("-1\n");
    return 0;
  }
  int l = 1, r = b - a + 1;
  while ((l + 1) < r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (check(l))
    printf("%d\n", l);
  else
    printf("%d\n", r);
  return 0;
}
