#include <bits/stdc++.h>
using namespace std;
const int M = 1000005;
bool mark[M];
int prime[M], tot;
int cnt[M];
void sieve(int m) {
  for (int i = 2; i < M; i++) {
    cnt[i] = cnt[i - 1];
    if (!mark[i]) {
      cnt[i]++;
      for (int j = i; j < M; j += i) mark[j] = 1;
    }
  }
}
int a, b, k;
bool check(int x, int v) { return (cnt[x] - cnt[v - 1]) >= k; }
const int INF = 2000000000;
int main() {
  scanf("%d%d%d", &a, &b, &k);
  sieve(b);
  int l = -1;
  for (int i = a; i <= b; i++) {
    int L = i, R = b, res = -1;
    while (L <= R) {
      int mid = L + R >> 1;
      if (check(mid, i))
        R = mid - 1, res = mid;
      else
        L = mid + 1;
    }
    if (res == -1) res = b - i + 1 + i;
    l = max(l, res - i + 1);
  }
  if (l <= b - a + 1)
    printf("%d\n", l);
  else
    printf("%d\n", -1);
  return 0;
}
