#include <bits/stdc++.h>
using namespace std;
int a, b, k;
bool arr[1000001];
int sum[1000001];
bool check(int l) {
  for (int i = a; i + l - 1 <= b; i++) {
    if (sum[i + l - 1] - sum[i - 1] < k) return 0;
  }
  return 1;
}
int bs(int s, int e) {
  int ret = -1;
  while (s <= e) {
    int mid = (s + e) / 2;
    if (check(mid)) {
      ret = mid;
      e = mid - 1;
    } else
      s = mid + 1;
  }
  return ret;
}
int main() {
  cin >> a >> b >> k;
  for (int i = 2; i <= b; i++) {
    if (arr[i] == 0) {
      for (int j = i + i; j <= b; j += i) {
        arr[j] = 1;
      }
    }
  }
  for (int i = 2; i <= b; i++) {
    sum[i] = sum[i - 1] + (!arr[i]);
  }
  cout << bs(1, b - a + 1) << endl;
  return 0;
}
