#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
bool p[N];
int x[N];
vector<int> r;
bool check(int m, int c, int a, int b) {
  for (int i = a; i <= b; i++) {
    int l = i, r = i + m - 1;
    if (r > b) break;
    if (x[r] - x[l - 1] < c) return false;
  }
  return true;
}
int main() {
  int a, b, c, res = N;
  cin >> a >> b >> c;
  for (long long i = 2; i <= N - 10; i++)
    for (long long j = i * i; j <= N - 10; j += i) p[j] = true;
  p[0] = p[1] = true;
  for (int i = 1; i <= N - 10; i++) x[i] = x[i - 1] + (p[i] ^ 1);
  int l = 0, r = b - a + 1;
  while (l <= r) {
    int m = (l + r) >> 1;
    if (check(m, c, a, b))
      res = m, r = m - 1;
    else
      l = m + 1;
  }
  cout << (res == N ? -1 : res) << "\n";
}
