stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <string>



#define MOD 1000000007



#define FOR(i, a, b) for (int i = (a); i < (b); i++)

#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)

#define REP(i, n) for (int i = 0; i < (n); i++)

#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)

#define ALL(x) (x).begin(), (x).end()

#define DEBUG(x) cout << #x << ": " << x << endl



// five-five-everywhere.cpp ---

// author: Seong Yong-ju <sei40kr@gmail.com>



using namespace std;



int n;

bool ps[55556] = {false, false};



int main() {

  std::ios::sync_with_stdio(false);



  cin >> n;

  fill(&ps[2], ps + 55555, true);

  for (int i = 2; i <= 55555; ++i) {

    if (!ps[i]) {

      continue;

    }

    for (int j = i * 2; j <= 55555; j += i) {

      ps[j] = false;

    }

  }

  REP(i, 55556) { ps[i] = (ps[i] && i % 5 == 1); }



  int cnt = 0;

  REP(i, 55556) {

    if (ps[i]) {

      if (n <= ++cnt) {

        cout << i << endl;

        break;

      } else {

        cout << i << ' ';

      }

    }

  }



  return 0;

}


// Optimized solution to the same problem (faster):
#include <cmath>

#include <iostream>

#include <string>



#define MOD 1000000007



#define FOR(i, a, b) for (int i = (a); i < (b); i++)



// five-five-everywhere.cpp ---

// author: Seong Yong-ju <sei40kr@gmail.com>



using namespace std;



int n;

bool isprime[55556] = {false, false};



int main() {

  ios::sync_with_stdio(false);

  cin.tie(NULL);



  fill(&isprime[2], isprime + 55556, true);



  cin >> n;



  FOR(i, 2, floor(sqrt(55556) + 1)) {

    if (!isprime[i]) {

      continue;

    }

    for (int j = i * 2; j < 55556; j += i) {

      isprime[j] = false;

    }

  }



  int cnt = 0;

  FOR(i, 2, 55556) {

    if (isprime[i] && i % 5 == 1) {

      cout << i;



      if (n <= ++cnt) {

        cout << endl;

        break;

      } else {

        cout << ' ';

      }

    }

  }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using pii = pair<int, int>;



int N;



int main() {

  cin.tie(0);

  ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(10);

  

  cin >> N;

  vector<int> v;

  for (int i = 11; i <= 55555; i += 5) {

    int no = 0;

    for (int j = 2; j * j <= i; j++) {

      if (i % j == 0) {

        no++;

        break;

      }

    }

    if (!no) v.emplace_back(i);

  }  

  for (int i = 0; i < N; i++) {

    cout << v[i] << " \n"[i + 1 == N];

  }



  return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using pii = pair<int, int>;



int N;



int main() {

  cin.tie(0);

  ios_base::sync_with_stdio(false);

  cout << fixed << setprecision(10);

  

  cin >> N;

  vector<int> p;

  for (int i = 11; p.size() < N; i += 5) {

    int flag = 1;

    for (int j = 2; j * j <= i; j++) {

      if (i % j == 0) flag = 0;

    }

    if (flag) p.emplace_back(i);

  }

  for (int i = 0; i < N; i++) {

    cout << p[i] << " \n"[i + 1 == N];

  }



  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)n;i++)

#define rep1(i,n) for(int i=1;i<=(int)n;i++)

#define rep2(i,j,n) for(int j=i;j<n;j++)

#define rep3(i,j,n) for(int j=i;j<=n;j++)

#define rrep(i,n) for(int i=n-1;i>=0;i--)

#define sp(n) cout << fixed << setprecision(n)

typedef long long ll;

using namespace std;

int pn[55]={11,31,41,61,71,91,101,131,151,181,

            191,211,241,251,271,281,311,331,401,421,

            431,461,491,521,541,571,601,641,661,691,

            701,751,761,811,821,881,911,941,971,991,

            1021,1051,1061,1091,1151,1171,1181,1201,1231,1291,

            1301,1321,1361,1381,1451

            };

int main(void){

    int n;cin>>n;

    vector<int> pr(55556,0);

    rep(i,55556){

        if(i==0||i==1)continue;

        for(int j=i*2;j<=55555;j+=i){

            if(pr[j]==0)pr[j]++;

        }

    }

    int cou=0;

    rep(i,55556){

        if(i==0||i==1)continue;

        if(pr[i]==0&&i%5==1){

            cout<<i<<" ";

            cou++;

        }

        if(cou==n)break;

    }

    cout<<endl;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)n;i++)

#define rep1(i,n) for(int i=1;i<=(int)n;i++)

#define rep2(i,j,n) for(int j=i;j<n;j++)

#define rep3(i,j,n) for(int j=i;j<=n;j++)

#define rrep(i,n) for(int i=n-1;i>=0;i--)

#define sp(n) cout << fixed << setprecision(n)

typedef long long ll;

using namespace std;

int pn[55]={11,31,41,61,71,101,131,151,181,191,

            211,241,251,271,281,311,331,401,421,431,

            461,491,521,541,571,601,631,641,661,691,

            701,751,761,811,821,881,911,941,971,991,

            1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,

            1291,1301,1321,1361,1381

            };

int main(void){

    int n;cin>>n;

    rep(i,n)cout<<pn[i]<<" ";

    cout<<endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)

#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)

#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)

#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)

#define all(x) (x).begin(), (x).end()

#define sz(x) ((int)(x).size())

#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())



const int MAX_A = 55555;

const int MAX_N = 55;



int n;

bool pf[MAX_A + 1];

vector<int> prime;



void create_prime() {

    rep(i, MAX_A + 1) pf[i] = true;

    pf[0] = pf[1] = false;

    

    for(int i = 2; (i * i) <= MAX_A; i++) {

        if (!pf[i]) {

            continue;

        }

        

        for (int ii = 2; (i * ii) <= MAX_A; ii++) {

            pf[i * ii] = false;

        }

    }

    

    for (int i = 0; i <= MAX_A; i++) {

        if (pf[i]) {

            prime.push_back(i);

        }

    }

}



bool is_prime(int n) {

    return pf[n];

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    

    cin >> n;

    create_prime();

    int cnt = 0;

    

    rep(i, n) {

        while(!pf[++cnt * 5 + 1]);

        printf("%d%s", cnt * 5 + 1, (i == (n - 1)) ? "\n" : " ");

    }

    

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)

#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)

#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)

#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)

#define all(x) (x).begin(), (x).end()

#define sz(x) ((int)(x).size())

#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())



const int MAX_A = 55555;



int n;

bool pf[MAX_A + 1];



void create_prime() {

    rep(i, MAX_A + 1) pf[i] = true;

    pf[0] = pf[1] = false;

    

    for(int i = 2; (i * i) <= MAX_A; i++) {

        if (!pf[i]) {

            continue;

        }

        

        for (int ii = 2; (i * ii) <= MAX_A; ii++) {

            pf[i * ii] = false;

        }

    }

}



bool is_prime(int n) {

    return pf[n];

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    

    cin >> n;

    create_prime();

    int cnt = 0;

    

    rep(i, n) {

        while(!pf[++cnt * 5 + 1]);

        printf("%d%s", cnt * 5 + 1, (i == (n - 1)) ? "\n" : " ");

    }

    

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <functional>

#include <map>

#include <ostream>

#include <queue>

#include <random>

#include <string>

#include <vector>

#include <cstdlib>

#include <cmath>

#include <cstring>



using std::cin;

using std::cout;

using std::cerr;

using std::endl;



using ll = long long;



inline void init() {

  cin.tie(0);

  std::ios::sync_with_stdio(false);

}



bool is_prime[300001];

std::vector<int> prime;



void eratosthenes(int n) {

  std::fill(is_prime, is_prime + 300000, true);



  is_prime[0] = is_prime[1] = false;



  for (int i = 2; i <= n; ++i) {

    if (is_prime[i]) {

      if (i <= 55555) prime.push_back(i);



      for (int j = 2; i * j <= n; ++j) {

        is_prime[i * j] = false;

      }

    }

  }



  return;

}



int main() {

  init();



  int N;



  cin >> N;



  eratosthenes(300000);



  std::vector<int> ans;



  for (int i = 0; i < prime.size(); ++i) {

    if (prime[i] % 5 == 1) {

      ans.push_back(prime[i]);

      if (ans.size() == N) {

        break;

      }

    }

  }



  for (int i = 0; i < N; ++i) {

    cout << ans[i] << " \n"[i == N - 1];

  }



  return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <algorithm>

#include <vector>

#include <cstring>



using std::cin;

using std::cout;

using std::cerr;

using std::endl;



std::vector<int> eratosthenes() {

  bool is_prime[55556];

  std::vector<int> ret;



  std::fill(is_prime, is_prime + 55555, true);



  is_prime[0] = is_prime[1] = false;



  for (int i = 2; i <= 55555; ++i) {

    if (is_prime[i]) {

      ret.push_back(i);

      for (int j = 2; i * j <= 55555; ++j) {

        is_prime[i * j] = false;

      }

    }

  }



  return ret;

}





int main() {

  int n;



  cin >> n;



  std::vector<int> prime = eratosthenes(), ans;



  for (int i = 0; i < int(prime.size()); ++i) {

    if (prime[i] % 5 == 1) {

      ans.push_back(prime[i]);

      if (int(ans.size()) == n) {

        break;

      }

    }

  }



  for (int i = 0; i < int(ans.size()); ++i) {

    cout << ans[i] << " \n"[i == n - 1];

  }



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <algorithm>

#include <string.h>

#include <iomanip>

#include <math.h>



typedef long long int ll;



#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)

#define REP(i,n) FOR(i,n,0)

#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

#define OF64 std::setprecision(10)



const ll MOD = 1000000007;



using namespace std;



const int MAX = 300000;



int Prime[55555];

bool isPrime[MAX];





int main()

{

	int N;

	cin >> N;

	REP(i, MAX)

	{

		isPrime[i] = true;

	}



	int num = 0;

	isPrime[0] = isPrime[1] = false;

	for (int i = 2; i < MAX; ++i)

	{

		if (!isPrime[i])continue;

		if (i <= 55555)

		{

			Prime[num++] = i;

		}

		for (int j = 2 * i; j < MAX; j += i)

		{

			isPrime[j] = false;

		}

	}



	vector<int> ans;

	REP(i, num)

	{

		if (Prime[i] % 10 == 1)

		{

			ans.push_back(Prime[i]);

		}

		if (ans.size() == N)break;

	}



	cout << ans[0];

	REP(i, N-1)

	{

		cout << " " << ans[i + 1];

	}

	cout<<endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#include <algorithm>

#include <string.h>

#include <iomanip>

#include <math.h>



typedef long long int ll;



#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)

#define REP(i,n) FOR(i,n,0)

#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

#define OF64 std::setprecision(10)



const ll MOD = 1000000007;



using namespace std;



struct PrimeList

{

	PrimeList()

	{

		prime.clear();

	};

	~PrimeList() {};



	void init(int n)

	{

		std::vector<bool> isComposite(n + 1);

		for (int i = 2; i <= n; ++i)

		{

			if (isComposite[i])continue;

			prime.push_back(i);

			for (int j = i; j <= n; j += i)

			{

				isComposite[j] = true;

			}

		}

	}



	std::vector<int> prime;

};





int main()

{



	int N;

	cin >> N;

	PrimeList prime;

	prime.init(55555);



	vector<int> ans;

	REP(i, prime.prime.size())

	{

		if (prime.prime[i] % 10 == 1)ans.push_back(prime.prime[i]);

		if (ans.size() == N)break;

	}



	REP(i, N)

	{

		cout << ans[i] << " ";

	}

	cout << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string.h>

#include <stdio.h>

#include <algorithm>

using namespace std;

int t[1000];

int p[56];

int r[1000];

int o;

int book[1000000];

int main()

{



    int u=0;

    for(int i=2; i<10000; i++)

    {

        if(book[i]==0)

            for(int j=2; j<10000; j++)

            {

                if(i*j>=10000)

                    break;

                book[i*j]=1;

            }

    }

    int n;

    int f[56];

    int v=0;

    for(int i=2;i<=10000;i++)

    {

        if(book[i]==0&&i%10==1)

        {

            f[v]=i;

            v++;

            if(v==57)

                break;

        }

    }

    while(scanf("%d",&n)!=EOF)

    {

        for(int i=0; i<n; i++)

            {

                if(i==0)

                    cout<<f[i];

                else

                    cout<<" "<<f[i];

            }

            cout<<endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>

#include <iostream>

#include <stack>

#include <queue>

#include <vector>

#include <cmath>

#include <algorithm>

#define LL long long

using namespace std;

/*int main()

{

    int x=11,j=0,i=0;

    while(j<56)

    {

        for( i=2; i<x/2; i++)

            if(x%i==0)break;

        if(i>=x/2)

        {

            printf("%d,",x);

            j++;

        }

        x+=10;

    }

}*/

int main()

{

    int zishu1[56]={11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451};

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

    {

        if(i==0)printf("%d",zishu1[i]);

        else printf(" %d",zishu1[i]);

    }

    printf("\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef pair<int,int> ii;

typedef pair<int,pair<int,int>> iii;

typedef vector<pair<int,int>> vii;

typedef vector<vector<int>> vvi;



#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define LSOne(i) ((i) & -(i))



const int MAXN = 55556;

bitset<MAXN> bs;

int n;

vi primes, ans;



void sieve () {

    bs.set();

    bs[0] = bs[1] = false;

    for (ll i = 2; i < bs.size(); i++) {

        if (bs[i]) {

            for (ll j = i*i; j < bs.size(); j += i)

                bs[j] = false;

            if (i%10 == 1) primes.pb(i);

        }

    }

}



int main (void) {

    ios_base::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);



    cin >> n;

    sieve();



    for (int i = 0; i < n; i++)

        cout << primes[i] << " ";

    cout << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <string.h>

#include <iostream>

#include <stack>

#include <queue>

#include <vector>

#include <cmath>

#include <algorithm>

#define LL long long

using namespace std;

/*int main()

{

    int x=11,j=0,i=0;

    while(j<56)

    {

        for( i=2; i<x/2; i++)

            if(x%i==0)break;

        if(i>=x/2)

        {

            printf("%d,",x);

            j++;

        }

        x+=10;

    }

}*/

int main()

{

    int zishu1[56]={11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451};

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

    {

        if(i==0)printf("%d",zishu1[i]);

        else printf(" %d",zishu1[i]);

    }

    printf("\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cstring>

#include <queue> //priority_queue

#include <map>

#include <set> //multiset set<int,greater<int>>大到小

#include <vector>// vector<int>().swap(v);清空释放内存

#include <stack>

#include <cmath> // auto &Name : STLName  Name.

#include <utility>

#include <sstream>

#include <string>//__builtin_popcount(ans);//获取某个数二进制位1的个数

#define mod 1000000007

#define mod9 998244353

typedef unsigned long long ull;

typedef long long ll;

typedef double db;

typedef long double ld;

const db eps=1e-10;

const int INF = 0x3f3f3f3f;

const ll inf=0x3f3f3f3f3f3f3f3f;

#define rep(i,be,en) for (int i=be;i<=en;i++)

#define per(i,be,en) for (int i=en;i>=be;i--)

//ll ksm(ll a,ll b,ll c){ll ans=1;a=a%c;while(b>0){if(b%2) ans=(ans*a)%c;b=b/2;a=(a*a)%c;}return ans;}

using namespace std;



const int N=2e5+7;

int t,n,m,fl=0;

int prime[N]={0};//记录素数

int vis[N]={0};//记录除本身最大因子

int cnt=0;//素数个数

void Euler_prime(int x){

    for(int i=2;i<=x;++i){

        if(vis[i]==0){

            prime[cnt++]=i;

            vis[i]=1;

        }

        for(int j=0;j<cnt;++j){

            if(i*prime[j]>x)//判断是否越界

                break;

            vis[i*prime[j]]=i;//筛数

            if(i%prime[j]==0)//时间复杂度为O(n)的关键！

                break;

        }

    }

}

int main(){

    Euler_prime(55556);

    scanf("%d",&n);

    rep(i,0,cnt-1){

        if(prime[i]%10==1){

            printf("%d%c",prime[i],n==1?'\n':' ');

            n--;

        }

        if(n<=0) break;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <algorithm>

#include <cstdio>

#include <cstring>

#include <cmath>

#include <set>

#include <map>

#include <vector>

#include <queue>

#define LL long long

#define N 55555

#define maxn 10005

#define INF 0x3f3f3f3f

#define mase(a,b) memset(a,b,sizeof(a))

#define MIN(a,b) (a<b?a:b)

#define MAX(a,b) (a>b?a:b)

#define DS DisputeSegement

using namespace std;

bool isPrime(int fig)

{

    int limit=(int)sqrt(fig)+1;

    for(int i=2;i<limit;i++)

    {

        if(fig%i==0)

        {

            return false;

        }



    }

    return true;

}

int main()

{

    int n;

    scanf("%d",&n);

    for(int i=11;i<=N;i+=10)

    {

        if(isPrime(i))

        {

            printf("%d",i);

            n--;

            printf("%c",n?' ':'\n');

            if(!n)

            {

                break;

            }

        }

    }

    return 0;

}





//Five,Five Everywhere,原创者CSDN@


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int,int> iint;

typedef pair<ll,ll> llll;

#define ALL(x) (x).begin(),(x).end()

const ll zero = 0;

const ll INF = 3000000000000000000; //10^18

const int inINF = 1000000000; //10^9

const ll MOD = 1000000007; //10^9+7

const ll MOD2 = 998244353;



int main(){

    int N;

    cin >> N;



    vector<bool> P(56000, true);

    P[0] = false;

    P[1] = false;

    for (int i = 2; i < 56000; i++) {

        if(P[i] == false){

            continue;

        }

        else{

            for (int j = 2; i * j < 56000; j++) {

                P[i * j] = false;

            }

        }

    }

    vector<int> ans;

    for (int i = 1; i < 56000; i+=5) {

        if(P[i] == true){

            ans.push_back(i);

        }

    }

    for (int i = 0; i < N; i++) {

        printf("%d ", ans[i]);

    }

    printf("\n");



}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int,int> iint;

typedef pair<ll,ll> llll;

#define ALL(x) (x).begin(),(x).end()

const ll zero = 0;

const ll INF = 3000000000000000000; //10^18

const int inINF = 1000000000; //10^9

const ll MOD = 1000000007; //10^9+7

const ll MOD2 = 998244353;



int main(){

    int N;

    cin >> N;



    vector<bool> P(56000, true);

    P[0] = false;

    P[1] = false;

    for (int i = 2; i < 250; i++) {

        if(P[i] == false){

            continue;

        }

        else{

            for (int j = i; i * j < 56000; j++) {

                P[i * j] = false;

            }

        }

    }

    vector<int> ans;

    for (int i = 1; i < 56000; i+=5) {

        if(P[i] == true){

            ans.push_back(i);

        }

    }

    for (int i = 0; i < N; i++) {

        printf("%d ", ans[i]);

    }

    printf("\n");



}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <string>

#include <vector>

using namespace std;

typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)

#define repe(i,s,n)for(ll i=s;i<=n;i++)



bool p[100001] = {};

vector<ll> g;



int main() {

	ll n; cin >> n;



	ll size = 100001;

	rep(i, 0, size) p[i] = true;



	p[0] = false;

	p[1] = false;



	for (int i = 2; i*i < size; i++) {

		if (p[i]) {

			for (int j = 2; i*j < size; j++) {

				p[i*j] = false;

			}

		}

	}



	rep(i, 0, size) {

		if (p[i] && i % 10 == 1) {

			g.push_back(i);

		}

	}



	rep(i, 0, n

	) {

		cout << g[i];

		if (i != g.size() - 1) {

			cout << " ";

		}

	}

	cout << endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <algorithm>

#include <vector>

#include <map>

using namespace std;

typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)

#define repe(i,s,n)for(ll i=s;i<=n;i++)



bool p[100001];

int main()

{

	ll n; cin >> n;



	ll maxV = 100000;

	rep(i, 0, maxV)p[i] = true;

	p[0] = false;

	p[1] = false;



	for (int i = 2; i*i <= maxV; i++) {

		if (!p[i])continue;

		for (int j = 2; i*j <= maxV; j++) {

			if (i*j <= maxV) {

				p[i*j] = false;

			}

		}

	}



	rep(i, 0, maxV) {

		if (p[i] && i % 10 == 1) {

			cout << i;

			n--;



			if (n != 0)cout << " ";



			if (n == 0) {

				break;

			}

		}

	}

	cout << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <string>

#include <vector>

#include <map>

using namespace std;

typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)

#define repe(i,s,n)for(ll i=s;i<=n;i++)



bool p[100000] = {};

vector<ll> ans;



int main() {

	ll n = 100000;

	rep(i, 0, n)p[i] = true;

	p[0] = false;

	p[1] = false;

	for (int i = 2; i*i < n; i++) {

		if (p[i]) {

			for (int j = 2; i*j < n; j++) {

				p[i*j] = false;

			}

		}

	}

	rep(i, 0, n) {

		if (p[i] && i % 10 == 1) {

			ans.push_back(i);

		}

	}



	ll N; cin >> N;

	rep(i, 0, N) {

		cout << ans[i];

		if (i != N - 1) {

			cout << " ";

		}

	}

	cout << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <algorithm>

#include <vector>

#include <map>

using namespace std;

typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)

#define repe(i,s,n)for(ll i=s;i<=n;i++)



bool p[100001];

int main()

{

	ll n; cin >> n;



	ll maxV = 100000;

	rep(i, 0, maxV)p[i] = true;

	p[0] = false;

	p[1] = false;



	for (int i = 2; i*i <= maxV; i++) {

		if (!p[i])continue;

		for (int j = 2; i*j <= maxV; j++) {

			if (i*j <= maxV) {

				p[i*j] = false;

			}

		}

	}



	rep(i, 0, maxV) {

		if (p[i] && i % 10 == 1) {

			cout << i;

			n--;



			if (n != 0)cout << " ";



			if (n == 0) {

				break;

			}

		}

	}

	cout << endl;

	return 0;

}

// Fastest known solution for this problem: