#include <bits/stdc++.h>
using namespace std;
int a2[2000005];
int main() {
  int a, b, k;
  cin >> a >> b >> k;
  for (int x = 2; x <= b + b - a + 1; x++) {
    if (!a2[x]) {
      for (int y = x * 2; y <= b + b - a + 1; y += x) a2[y] = 1;
    }
  }
  for (int x = 2; x <= b + b - a + 1; x++) {
    if (a2[x])
      a2[x] = 0;
    else
      a2[x] = 1;
  }
  for (int x = a; x <= b + b - a + 1; x++) {
    a2[x] += a2[x - 1];
  }
  int i = k;
  for (int x = a; x + i - 1 <= b; x++) {
    while (a2[x + i - 1] - a2[x - 1] < k) {
      i++;
      if (x + i > b && x > a) x--;
      if (i > b - a + 1) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << (k <= b - a + 1 ? i : -1);
}
