#include #include bool smallprime(int n) { if (n == 2 || n == 3 || n == 5 || n == 7) return true; return 0 != n%2 && 0 != n%3 && 0 != n%5 && 0 != n%7; } main() { // find the primes vector p; for (int i = 2; i < 100; ++i) if (smallprime(i)) p.push_back(i); // for (vector::iterator q = p.begin(); q < p.end(); ++q) // cerr << *q << " "; // cerr << endl << p.size() << endl; // find the smoothie long long n; while (cin >> n) { vector::iterator q; long long m, k = n; do { for (q = p.begin(), m = ++n; m > 1 && q < p.end(); ++q) while (0 == (m%*q)) m /= *q; } while (m != 1); cout << k << " " << n << endl; } }