#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(long long n)
{
long long count = sqrt(n);
for (long long i = 2; i <= count; i++)
{
if (n % i == 0)
return false;
}
return true;
}
int main(void)
{
long long n;
cin >> n;
for (long long i = 0; i < n; i++)
{
long long tmp;
cin >> tmp;
if (tmp == 1 || tmp == 0)
{
cout << '2' << '\n';
continue;
}
while (!isPrime(tmp))
{
tmp++;
}
cout << tmp << '\n';
}
}
Coding/BaekJoon