#include<iostream>
using namespace std;int n,a;
bool judge(int n){if(n <2)return false;for(int i =2; i <= n / i; i++){if(n % i ==0)return false;}return true;}intmain(){
cin>>n;while(n--){
cin>>a;if(judge(a)) cout<<"Yes"<<endl;else cout<<"No"<<endl;}return0;}
2. 分解质因数
voiddivide(int n){for(int i =2;i <= n / i; i++){if(n % i ==0){int s =0;while(n % i ==0){
n /= i;
s++;}
cout<<i<<" "<<s<<endl;}}if(n >1){
cout<<n<<" "<<1<<endl;}}
3. 筛质数
3.1 朴素做法
// 求出 1 ~ n 中质数的数量,prime 中存的就是 所有的质数intgetPrimeNumber(int n){for(int i =2; i <= n; i++){if(!st[i]){
prime[index++]= i;}for(int j = i + i; j <= n; j = j + i){
st[j]= true;}}return index;}
3.2 埃式优化
// 求出 1 ~ n 中质数的数量,prime 中存的就是 所有的质数intgetPrimeNumber(int n){for(int i =2; i <= n; i++){if(!st[i]){
prime[index++]= i;for(int j = i + i; j <= n; j = j + i){
st[j]= true;}}}return index;}
4. 试除法求约数
vector<int>getSubmultiple(int n){
vector<int> res;for(int i =1; i <= n / i; i++){if(n % i ==0){
res.push_back(i);if(i != n / i){
res.push_back(n / i);}}}sort(res.begin(),res.end());return res;}
5. 约数的个数
longlonggetNum(vector<int> nums){
unordered_map<int,int> map;for(auto n : nums){for(int i =2; i <= n / i; i++){if(n % i ==0){while(n % i ==0){
n /= i;
s++;
map[i]++;}}}if(n >1) map[n]++;}longlong res =1l;for(auto x : map){
res = res *(x.second +1)% mod;}return res;}
6. 约数之和
longlonggetSum(vector<int> nums){
unordered_map<int,int> map;for(auto n : nums){for(int i =2; i <= n / i; i++){if(n % i ==0){while(n % i ==0){
n /= i;
map[i]++;}}}if(n >1) map[n]++;}longlong res =1l;for(auto x : map){longlong a = x.first, b = x.second;longlong t =1;while(b --) t =(t * a +1)% mod;
res = res * t % mod;}return res;}
7. 最大公约数
longlonggcd(int a,int b){return b?gcd(b,a%b):a;}
8. 最小公倍数
longlonggcd(int a,int b){return b?gcd(b,a%b):a;}// 最小公倍数longlonggcm(int a,int b){return a * b /gcd(a,b);}
9. 欧拉函数
intgetPrimeNum(int a){int res = a;// 分解质因数for(int i =2; i <= a / i; i++){if(a % i ==0){
res = res / i *(i -1);while(a % i ==0){
a = a / i;}}}if(a >1){
res = res / a *(a -1);}return res;}
10. 快速幂
#include<iostream>
using namespace std;intmain(){int n;
cin>>n;while(n--){int a,b,p;
cin>>a>>b>>p;int res =1% p;while(b){if(b &1) res = res *1LL* a % p;
a = a *1LL* a % p;
b>>=1;}
cout<<res<<endl;}return0;}
11. 求组合数
voidinit(){for(int i =0; i < N; i++){for(int j =0; j <= i; j++){if(!j){
c[i][j]=1;}else{
c[i][j]=(c[i-1][j]+ c[i-1][j-1])%mod;}}}}