#include <bits/stdc++.h>
using namespace std;
bool Isprime(int x) {
  int i, sq;
  sq = sqrt((double)x + .001);
  if (x == 2) return true;
  if (x % 2 == 0) return false;
  for (i = 3; i <= sq; i += 2) {
    if (x % i == 0 && x != i) return false;
  }
  return true;
}
int PC[1000011];
bool isp[1000011];
int Diff(int a, int b) {
  int ans;
  ans = PC[b] - PC[a];
  return isp[b] ? ans + 1 : ans;
}
int main() {
  int i, a, b, k, l;
  PC[0] = PC[1] = PC[2] = 0;
  isp[0] = isp[1] = 0;
  for (i = 3; i < 1000011; i++) {
    PC[i] = PC[i - 1];
    isp[i - 1] = Isprime(i - 1);
    if (isp[i - 1]) PC[i]++;
  }
  cin >> a >> b >> k;
  if (Diff(a, b) < k)
    cout << -1 << endl;
  else {
    i = 0;
    while (Diff(a, a + i) < k) i++;
    l = i + 1;
    for (; a + i <= b; i++)
      if (Diff(a + i - l + 1, a + i) < k) l++;
    cout << l << endl;
  }
  return 0;
}
