#include <bits/stdc++.h>
int main(int argc, char** argv) {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  int a, b, k;
  std::cin >> a >> b >> k;
  std::vector<int> is_prime(1111111 + 1, 1);
  is_prime[0] = is_prime[1] = 0;
  for (int i = 2; i * i <= 1111111; i++)
    if (is_prime[i])
      for (int j = i + i; j <= 1111111; j += i) is_prime[j] = 0;
  std::vector<int> cdf(1111111 + 2, 0);
  std::partial_sum(is_prime.begin(), is_prime.end() - 1, cdf.begin() + 1);
  int l = 0, u = b - a + 1 + 1;
  while (u - l > 1) {
    int m = (l + u) / 2;
    int size = b - a + 1;
    int c = 0;
    for (int i = a; i + m - 1 <= b; i++)
      if (cdf[i + m] - cdf[i] >= k) c++;
    if (c >= size - m + 1) {
      u = m;
    } else {
      l = m;
    }
  }
  if (1 <= u && u <= b - a + 1) {
    std::cout << u << std::endl;
  } else {
    std::cout << -1 << std::endl;
  }
  return 0;
}
