#include<bits/stdc++.h>
using namespace std;
bool status[1100000002];
void siv()
{
int N=20000000;
int sq=sqrt(N);
for(int i=4; i<=N; i+=2) status[i]=1;
for(int i=3; i<=sq; i+=2)
{
if(status[i]==0)
{
for(int j=i*i; j<=N; j+=i) status[j]=1;
}
}
status[1]=1;
}
vector < pair<long long int , long long int> >v;
void Pair()
{
v.push_back(pair<long long int , long long int> (0, 0));
for(long long int i=3;i<=20000000;i+=2)
{
if(status[i]==0&&status[i+2]==0)
{
v.push_back(pair<long long int , long long int> (i, i+2));
}
}
}
int main()
{
siv();
Pair();
long long int i,j,k,n,w,a,b,f;
while(cin>>n)
{
f=0;
cout<<"("<<v[n].first<<", "<<v[n].second<<")"<<endl;
}
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.