#include <bits/stdc++.h>
using namespace std;
int p[1001000];
int main() {
  int a, b, k;
  cin >> a >> b >> k;
  for (int i = 2; i <= b + 20; i++) p[i] = 1;
  for (int i = 2; i <= b + 20; i++)
    if (p[i])
      for (int j = i + i; j <= b + 10; j = j + i) p[j] = 0;
  for (int i = 1; i < b + 10; i++) p[i] = p[i] + p[i - 1];
  int lo, hi, m;
  lo = 0;
  hi = b - a + 2;
  while (lo < hi) {
    int f = 1;
    m = (lo + hi) / 2;
    for (int i = a - 1; i + m <= b; i++) {
      if (p[i + m] - p[i] < k) {
        f = 0;
        break;
      }
    }
    if (f == 1) {
      hi = m;
    } else
      lo = m + 1;
  }
  if (lo > b - a + 1) {
    cout << "-1" << endl;
  } else
    cout << lo << endl;
  return 0;
}
