#include <bits/stdc++.h>
using namespace std;
const int LEN = 1e6 + 1;
int ar[LEN];
int a, b, k;
bool check(int mid) {
  int t = a;
  while (t + mid - 1 <= b) {
    if (ar[t + mid - 1] - ar[t - 1] < k) return false;
    t++;
  }
  return true;
}
int main(void) {
  int sum = 0;
  ar[0] = 0;
  ar[1] = 0;
  for (int i = 2; i <= LEN; ++i) {
    if (!ar[i]) {
      for (int j = 2 * i; j <= LEN; j += i) {
        if (!ar[j]) ar[j] = 1;
      }
      ++sum;
    }
    ar[i] = sum;
  }
  cin >> a >> b >> k;
  int left = k, right = b - a + 1;
  if (right >= left) {
    sum = ar[b] - ar[a - 1];
    if (sum < k)
      cout << -1 << endl;
    else {
      while (right > left) {
        int mid = left + (right - left) / 2;
        if (check(mid))
          right = mid;
        else
          left = mid + 1;
      }
      cout << right << endl;
    }
  } else
    cout << -1 << endl;
  return 0;
}
