#include <bits/stdc++.h>
using namespace std;
bool prime[1000010];
int num[1000010];
int judge(int a, int b, int k, int l) {
  int i;
  for (i = a; i <= b - l + 1; i++)
    if (num[i + l - 1] - num[i - 1] >= k)
      continue;
    else
      return 0;
  return 1;
}
int main() {
  int i, j, a, b, k;
  memset(num, 0, sizeof(num));
  for (i = 2; i < 1000001; i++) prime[i] = true;
  for (i = 2; i < 1000001; i++)
    if (prime[i]) {
      num[i] = num[i - 1] + 1;
      for (j = 2 * i; j < 1000001; j = j + i) prime[j] = false;
    } else
      num[i] = num[i - 1];
  while (cin >> a >> b >> k)
    if (!judge(a, b, k, b - a + 1))
      printf("-1\n");
    else {
      int l = 1, r = b - a + 1, mid;
      while (l <= r) {
        mid = (l + r) / 2;
        if (judge(a, b, k, mid))
          r = mid - 1;
        else
          l = mid + 1;
      }
      cout << l << endl;
    }
  return 0;
}
