#include <bits/stdc++.h>
using namespace std;
template <typename T>
void show(const T& v) {
  cerr << v << ' ';
}
template <typename T1, typename... T2>
void show(const T1& first, const T2&... rest) {
  show(first);
  show(rest...);
}
template <typename F, typename S>
ostream& operator<<(ostream& os, const pair<F, S>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename F, typename S>
ostream& operator<<(ostream& os, const map<F, S>& v) {
  os << "[";
  typename map<F, S>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
int const lim = 1e6 + 5;
long long mark[lim];
void sieve() {
  for (int i = 0; i < lim; i++) mark[i] = 1;
  mark[0] = mark[1] = 0;
  for (long long i = 4; i < lim; i += 2) mark[i] = 0;
  for (long long i = 3; i < lim; i += 2) {
    if (mark[i]) {
      for (long long j = i * i; j < lim; j += 2 * i) mark[j] = 0;
    }
  }
  for (int i = 1; i < lim; i++) mark[i] += mark[i - 1];
}
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  sieve();
  int a, b, k, pos;
  cin >> a >> b >> k;
  pos = k - 1;
  if (mark[b] - mark[a - 1] < k) return cout << "-1" << endl, 0;
  bool flag = true;
  for (int i = a; i + pos <= b; i++) {
    long long temp = mark[i + pos] - mark[i - 1];
    while (temp < k) {
      pos++;
      if (i + pos > b) break;
      temp = mark[i + pos] - mark[i - 1];
    }
  }
  cout << pos + 1 << endl;
  return 0;
}
