Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
660 B
1
Indexable
Never
**Eith Prime
#include <bits/stdc++.h>

using namespace std;

int vis[1000];
vector<int> prime, Eith;
void p()
{
	for (int i = 2; i < 1000; i++)
	{
		if (vis[i] == 0)
		{

			prime.push_back(i);
			for (int j = i * 2; j < 1000; j += i)
			{
				vis[j] = 1;
			}
		}
	}
}
int32_t main()
{
	p();
	for (int i = 0; i < prime.size(); i++)
	{
		for (int j = i + 1; j < prime.size(); j++)
		{
			int x = prime[i] + prime[j];
			if (vis[x] == 0)
			{
				Eith.push_back(x);
			}
		}
	}




	int t; cin >> t;
	while (t--)
	{
		int n; cin >> n;
		// cout << n << endl;
		cout << Eith[n - 1] << endl;
	}
	return 0;
}



Leave a Comment