#include <bits/stdc++.h>
using namespace std;
bool arr[1000010];
int sum[1000010];
int a, b, k;
void solve() {
  arr[0] = arr[1] = true;
  int sq = sqrt(1000010);
  for (int i = 2; (i) <= (sq); i++) {
    for (int j = i * i; j < 1000010; j += i) {
      arr[j] = true;
    }
  }
  int tot = 0;
  for (int i = 0; (i) < (1000010); i++) {
    if (!arr[i]) tot++;
    sum[i] = tot;
  }
}
bool is_legal(int l) {
  for (int i = a; i <= b - l + 1; i++) {
    if (sum[i + l - 1] - sum[i - 1] < k) return false;
  }
  return true;
}
int main() {
  solve();
  cin >> a >> b >> k;
  solve();
  if (sum[b] - sum[a - 1] < k) {
    cout << "-1\n";
    return 0;
  }
  int high = b - a + 1;
  int low = 1;
  while (high - low > 1) {
    int mid = low + ((high - low) / 2);
    if (is_legal(mid)) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  if (is_legal(low)) high = low;
  cout << high << endl;
  return 0;
}
