#include <bits/stdc++.h>
using namespace std;
bool vis[1001000];
int a, b, k;
void sieve(int n) {
  for (int i = 2; i <= n; i++) {
    if (vis[i] == 0) {
      for (int j = 2 * i; j <= n; j += i) vis[j] = 1;
    }
  }
}
int sum[1001000];
bool ok(int x, int l, int k) { return sum[x + l - 1] - sum[x - 1] >= k; }
bool solve(int l, int k) {
  for (int i = a; i <= b + 1 - l; i++) {
    if (!ok(i, l, k)) return false;
  }
  return true;
}
int bsearch(int p, int q, int k) {
  if (p == q) {
    if (solve(p, k))
      return p;
    else
      return -1;
  }
  int m = (p + q) >> 1;
  if (solve(m, k)) {
    return bsearch(p, m, k);
  } else
    return bsearch(m + 1, q, k);
}
int main() {
  cin >> a >> b >> k;
  sieve(1000000);
  vis[1] = 1;
  sum[0] = 0;
  for (int i = a; i <= b; i++) {
    sum[i] = sum[i - 1] + (vis[i] == 0);
  }
  cout << bsearch(1, b - a + 1, k);
}
