#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000000 + 10;
bool prime[MAXN];
int a, b, k, cut;
bool Judge(int mid) {
  int i;
  for (i = 0; i < mid; i++) {
    if (!prime[a + i]) cut++;
  }
  if (cut < k) return false;
  return true;
}
int main() {
  int i, j;
  prime[1] = 1;
  for (i = 2; i < MAXN; i++) {
    if (!prime[i]) {
      for (j = i << 1; j < MAXN; j += i) {
        if (!prime[j]) prime[j] = 1;
      }
    }
  }
  while (scanf("%d%d%d", &a, &b, &k) != EOF) {
    int L = 1, R = b - a + 1, mid, res = 0;
    while (L <= R) {
      mid = (L + R) >> 1;
      cut = 0;
      if (Judge(mid) == false)
        L = mid + 1;
      else {
        for (i = a + mid; i <= b; i++) {
          if (!prime[i]) cut++;
          if (!prime[i - mid]) cut--;
          if (cut < k) {
            L = mid + 1;
            break;
          }
        }
        if (i == b + 1) {
          R = mid - 1;
          res = mid;
        }
      }
    }
    if (res == 0)
      printf("-1\n");
    else
      printf("%d\n", res);
  }
  return 0;
}
