#include <bits/stdc++.h>
using namespace std;
bool vis[1000001];
int dp[1000001], a, b, k;
bool check(int l) {
  for (int i = a + l - 1; i <= b; i++) {
    if (dp[i] - dp[i - l] < k) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 2; i * i <= 1000000; i++) {
    if (!vis[i]) {
      for (int j = i * i; j <= 1000000; j += i) vis[j] = true;
    }
  }
  for (int i = 2; i <= 1000000; i++) {
    dp[i] = dp[i - 1];
    if (!vis[i]) dp[i]++;
  }
  cin >> a >> b >> k;
  int l = 1, r = b - a + 1, ans = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
}
