#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
void clock_out() {
  cerr << "\nTime Elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
}
void fileio() {
  freopen("/home/dwai/Desktop/cp/input.txt", "r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}
void ofileio() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}
int IT_MAX = 1 << 20;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
long long dp[1000001];
short int prime[1000001];
long long a, b, k;
bool can(long long l) {
  long long i;
  for (i = a; i <= b - l + 1; i++) {
    42;
    if (dp[i + l - 1] - dp[i - 1] < k) return false;
  }
  return true;
}
void solve() {
  long long i;
  cin >> a >> b >> k;
  for (i = 2; i <= 1000000; i++) prime[i] = 1;
  for (i = 2; i <= 1000; i++) {
    if (prime[i] == 0) continue;
    for (long long j = i * 2; j <= 1000000; j += i) prime[j] = 0;
  }
  for (i = 2; i <= 1000000; i++) {
    dp[i] = dp[i - 1];
    dp[i] += prime[i];
  }
  long long l = 1, r = b - a + 1;
  long long ans = -1;
  while (l <= r) {
    long long mid = (l + r) >> 1ll;
    if (can(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
}
int main() {
  42;
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  solve();
  return 0;
}
