#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int sum[maxn];
int is_sushu[maxn];
int a, b, k;
void shaifa() {
  memset(sum, 0, sizeof(sum));
  memset(is_sushu, 0, sizeof(is_sushu));
  for (int i = 2; i < maxn; i++) {
    sum[i] = sum[i - 1];
    if (is_sushu[i] == 0) {
      sum[i]++;
      for (int j = 1; i * j <= maxn; j++) is_sushu[i * j] = 1;
    }
  }
}
bool check(int x) {
  for (int i = a; i <= b - x + 1; i++)
    if (sum[i + x - 1] - sum[i - 1] < k) return 0;
  return 1;
}
int main() {
  shaifa();
  while (~scanf("%d%d%d", &a, &b, &k)) {
    if (sum[b] - sum[a - 1] < k) {
      printf("-1\n");
      return 0;
    }
    int left = 1;
    int right = b - a + 1;
    int num;
    while (left <= right) {
      int mid = (left + right) / 2;
      if (check(mid)) {
        num = mid;
        right = mid - 1;
      } else
        left = mid + 1;
    }
    printf("%d\n", num);
  }
}
