#include <bits/stdc++.h>
using namespace std;
namespace IO {
const int MAXIOSIZE = 1 << 24 | 1;
unsigned char buf[MAXIOSIZE], *p1, *p2;
template <typename T>
void read(T& x) {
  x = 0;
  char ch =
      (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 24, stdin), p1 == p2)
           ? EOF
           : *p1++);
  bool flg = false;
  for (; ch < '0' || '9' < ch;
       ch = (p1 == p2 &&
                     (p2 = (p1 = buf) + fread(buf, 1, 1 << 24, stdin), p1 == p2)
                 ? EOF
                 : *p1++))
    if (ch == '-') flg |= true;
  for (; '0' <= ch && ch <= '9';
       ch = (p1 == p2 &&
                     (p2 = (p1 = buf) + fread(buf, 1, 1 << 24, stdin), p1 == p2)
                 ? EOF
                 : *p1++))
    x = x * 10 + ch - '0';
  flg ? x = -x : 0;
}
template <typename T>
void out(const T& x) {
  if (x > 9) out(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void write(const T& x, const char& ed = ' ') {
  if (x < 0)
    putchar('-'), out(-x);
  else
    out(x);
  putchar(ed);
}
}  // namespace IO
const int MAXN = 1e6 + 10;
int L, R, k;
vector<int> prime;
bool tag[MAXN];
int main() {
  IO::read(L), IO::read(R), IO::read(k);
  tag[1] = true;
  for (int i = (2), iend = (R); i <= iend; ++i) {
    if (!tag[i]) prime.push_back(i);
    for (int j = 0; j < prime.size() && prime[j] * i <= R; ++j) {
      tag[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
  auto it = prime.begin();
  for (; it != prime.end(); ++it)
    if (*it >= L) break;
  prime.erase(prime.begin(), it);
  if (prime.size() < k) return puts("-1"), 0;
  int ans = prime[k - 1] - L + 1;
  for (int i = 0; i < prime.size() - k; ++i)
    ans = max(ans, prime[i + k] - prime[i]);
  ans = max(ans, R - prime[prime.size() - k] + 1);
  IO::write(ans);
  return 0;
}
