#include <bits/stdc++.h>
using namespace std;
const int maxnum = 1000000, geps = 1;
bool not_prime[1000001];
int prime[1000001], pi = 0;
int sum[1000001];
void getprime(int top) {
  not_prime[1] = true;
  for (int i = 2; i <= top; i++) {
    if (!not_prime[i]) prime[++pi] = i;
    for (int j = 1; j <= pi && i * prime[j] <= top; j++) {
      not_prime[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
}
int a, b, k;
void Init() {
  scanf("%d%d%d", &a, &b, &k);
  getprime(b);
  for (int i = 1; i <= b; i++) sum[i] = sum[i - 1] + (!not_prime[i]);
}
bool check(int l) {
  for (int i = a + l - 1; i <= b; i++)
    if (sum[i] - sum[i - l] < k) return false;
  return true;
}
void solve() {
  int l = 1, r = b - a + 1;
  for (int m = (l + r) >> 1; l <= r; m = (l + r) >> 1)
    check(m) ? r = m - 1 : l = m + 1;
  if (l == b - a + 2)
    cout << -1 << endl;
  else
    cout << l << endl;
}
int main() {
  cin >> a >> b >> k;
  getprime(b);
  for (int i = 1; i <= b; i++) sum[i] = sum[i - 1] + (!not_prime[i]);
  solve();
  return 0;
}
