#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
const int MAXN = (int)1e6 + 20;
int sm[MAXN], vis[MAXN];
int a, b, k;
bool f(int len) {
  int l = a, r = a + len - 1;
  int c = sm[r] - sm[a - 1];
  while (r <= b) {
    if (c < k) return 0;
    ++r;
    ++l;
    if (!vis[l - 1]) --c;
    if (!vis[r]) ++c;
  }
  return 1;
}
int main() {
  int i, j;
  vis[1] = 1;
  sm[1] = 0;
  for (i = 2; i < MAXN; ++i) {
    sm[i] = sm[i - 1];
    if (!vis[i]) {
      ++sm[i];
      for (j = 2 * i; j < MAXN; j += i) vis[j] = 1;
    }
  }
  while (scanf("%d%d%d", &a, &b, &k) != EOF) {
    int l = 1, r = b + 1 - a;
    int ans = -1;
    while (l <= r) {
      int mid = l + r >> 1;
      if (f(mid)) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    printf("%d\n", ans);
  }
}
