#include <bits/stdc++.h>
using namespace std;
int A, B, K, s, t, ans, l, sum[1000005];
bool found, prime[1000005];
void sieve(int N) {
  for (int i = (int)0; i <= (int)N; i++) prime[i] = 1;
  prime[0] = prime[1] = 0;
  for (int i = 2; i * i <= N; i++)
    if (prime[i])
      for (int j = i * i; j <= N; j += i) prime[j] = 0;
}
int main() {
  scanf("%d %d %d", &A, &B, &K);
  sieve(B);
  sum[0] = 0;
  for (int i = (int)1; i <= (int)B; i++) sum[i] = sum[i - 1] + prime[i];
  s = 1, t = B - A + 1, ans = -1;
  while (s <= t) {
    l = (s + t) / 2;
    found = 0;
    for (int x = (int)A; x <= (int)B - l + 1; x++)
      if (sum[x + l - 1] - sum[x - 1] < K) {
        found = 1;
        s = l + 1;
        break;
      }
    if (!found) {
      ans = l;
      t = l - 1;
    }
  }
  printf("%d\n", ans);
}
