#include <bits/stdc++.h>
using namespace std;
int m[2000000];
int a, b, k;
int main() {
  cin >> a >> b >> k;
  for (int i = 2; i <= b; ++i)
    if (m[i] == 0) {
      m[i] = 1;
      for (int j = i + i; j <= b; j = j + i) m[j] = 2;
    }
  for (int i = 2; i <= b; ++i)
    if (m[i] == 2) m[i] = 0;
  int l = a;
  int r = a;
  int t = 0;
  for (r = a; r <= b && t < k; ++r)
    if (m[r] == 1) {
      ++t;
      if (t == k) break;
    }
  if (k > t) {
    cout << -1;
    return 0;
  }
  for (r = r; r <= b;) {
    if (r + 1 > b) break;
    if (m[l] == 1) t--;
    ++l;
    ++r;
    if (r <= b && m[r] == 1) ++t;
    while (t < k && r <= b) {
      ++r;
      if (m[r] == 1) ++t;
    }
  }
  cout << r - l + 1;
  return 0;
}
