#include <bits/stdc++.h>
using namespace std;
int a, b, k, np = 0;
int p[1000001];
void mkprim() {
  for (int i = 2; i <= b; ++i) p[i] = 1;
  for (int i = 2; i <= b; ++i)
    if (p[i]) {
      for (long long j = (long long)i * i; j <= b; j += i) p[j] = 0;
    }
}
int main() {
  cin >> a >> b >> k;
  mkprim();
  for (int i = a + 1; i <= b; ++i) p[i] += p[i - 1];
  p[a - 1] = 0;
  if (p[b] < k)
    puts("-1");
  else {
    int ans = 1, st;
    for (st = a - 1; st + ans < b; ++st)
      while (st + ans < b && p[st + ans] - p[st] < k) ++ans;
    for (st = b; p[b] - p[st] < k; --st)
      ;
    if (b - st > ans) ans = b - st;
    cout << ans;
  }
  return 0;
}
