#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
bool flag[maxn];
int s[maxn];
int a, b, k;
void init() {
  memset(flag, true, sizeof(flag));
  flag[1] = false;
  for (int i = 2; i < maxn; i++) {
    if (flag[i]) {
      for (int j = 2 * i; j < maxn; j += i) flag[j] = false;
    }
  }
  s[0] = 0;
  for (int i = 1; i < maxn; i++) s[i] = s[i - 1] + flag[i];
}
bool judge(int mid) {
  for (int i = a; i + mid - 1 <= b; i++) {
    int j = i + mid - 1;
    if (s[j] - s[i - 1] < k) return false;
  }
  return true;
}
int main() {
  init();
  while (scanf("%d%d%d", &a, &b, &k) != EOF) {
    int l = 1, r = b - a + 1, ans = -1;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (judge(mid)) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
