#include <bits/stdc++.h>
using namespace std;
int n, m, k, x;
char simp[1000001];
int main(int argc, char** argv) {
  int a, b;
  cin >> a >> b >> k;
  memset(simp, 1, 1000001 * sizeof(char));
  simp[0] = simp[1] = 0;
  int s = 2;
  int s2, cn;
  while (s < b) {
    while (simp[s] == 0) {
      ++s;
    }
    cn = 2 * s;
    while (cn <= b) {
      simp[cn] = 0;
      cn += s;
    }
    ++s;
  }
  int a0 = a;
  int l = 1;
  int sum = 0;
  while ((sum < k) && (a0 <= b)) {
    sum += simp[a0];
    ++a0;
  }
  l = a0 - a;
  if (sum < k) {
    cout << "-1";
    return 0;
  }
  while (a0 <= b) {
    sum = sum + simp[a0] - simp[a0 - l];
    ++a0;
    if (sum < k) {
      ++sum;
      ++l;
    }
  }
  cout << l;
  return 0;
}
