#include <iostream>  // PRIME_10k.cpp DANILIN
#include <cmath> // rextester.com/ZUNIGB54689
using namespace std; int main() // 104743
{ setlocale (LC_ALL, "RUS"); srand(time(NULL));
  int max=10004, n=1, p=1; int f, j; double s;
while (n <= max) 
{ f=0; j=2; s = int (pow(p, 0.5));
   while (f < 1)
      { if (j >= s) f=2; 
        if (int(p) % int(j) == 0) f=1; 
        j++;
      }
   if (f != 1) { n++; } // cout << n <<" "<< p << endl; 
   p++;
}
cout << n-1 <<" "<< p-1 << endl; 
system("pause");
}
