// An example solution that is not efficient enough // It has temporal complexity O(Q*N), where N is the maximum possible number #include using namespace std; bool isPrime(int n) { if (n<2) return false; for (int i=2; i> q; for (int i=0; i> n; if (isPrime(n)) cout << n << " is prime" << endl; else cout << n << " is composite" << endl; } return 0; }