#include <bits/stdc++.h>
using namespace std;
int cum[1000001];
bool isprim[1000001];
void prim(int n) {
  int i, j;
  memset(isprim, true, sizeof(isprim));
  isprim[0] = isprim[1] = false;
  for (i = 2; i * i <= n; ++i)
    if (isprim[i])
      for (j = i * i; j <= n; j += i) isprim[j] = false;
}
bool canbe(int a, int b, int k, int L) {
  int i;
  if (cum[L - 1] < k) return false;
  for (i = a + 1; i <= b - L + 1; ++i)
    if (cum[i - a + L - 1] - cum[i - a - 1] < k) return false;
  return true;
}
int main(void) {
  int i, a, b, k, ans, l, r, mid;
  prim(1000000);
  scanf("%d%d%d", &a, &b, &k);
  if (isprim[a])
    cum[0] = 1;
  else
    cum[0] = 0;
  for (i = a + 1; i <= b; ++i)
    if (isprim[i])
      cum[i - a] = cum[i - a - 1] + 1;
    else
      cum[i - a] = cum[i - a - 1];
  l = 1, r = b - a + 1;
  while (l < r) {
    mid = l + (r - l) / 2;
    if (canbe(a, b, k, mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (!canbe(a, b, k, r))
    puts("-1");
  else
    printf("%d\n", r);
  return 0;
}
