Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func search(min, max int, channel chan int) {
	flag := false
	count := 0
	for i := min; i <= max; i++ { //1を除く入力値以下の数字
		for j := 2; j < i; j++ {
			if i%j == 0 {
				flag = true
				break
			}
		}
		if !flag {
			count++
		} else {
			flag = false
		}
	}
	channel <- count
	return
}

func main() {
	count := 0
	channel := make(chan int)
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		for i := 2; i < num; i += 10 {
			if i+10 < num {
				count++
				go search(i, i+10, channel)
			} else {
				count++
				go search(i, num, channel)
			}
		}
		var ans int
		for i := 0; i < count; i++ {
			ans += <-channel
		}

		fmt.Println(ans)
	}
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#define mem(name,value) memset(name,value,sizeof(name))
#define loop(i,from,to) for(int i=from;i<to;i++)
#define loopr(i,from,to) for(int i=from;i>=to;i--)
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=0x3f3f3f3f;

const int maxn=1000000+5;
int pr[maxn];
bool is_pr[maxn];

int sieve(int n){
    int p=0;
    loop(i,0,n+1) is_pr[i]=true;
    is_pr[0]=is_pr[1]=false;
    loop(i,2,n+1){
        if(is_pr[i]){
            pr[p++]=i;
            for(int j=2*i;j<=n;j+=i)
                is_pr[j]=false;
        }
    }
    return p;
}

int main()
{
    int n;
    while(cin>>n)
        cout<<sieve(n)<<endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int n, cnt;	
	bool prime[1000000];
	while(cin >> n){
		prime[n] = {false};
		prime[1] = true;
		
		// ??¨??????????????????????????????
		for(int j = 2; j*j <= n; j++){
			if(prime[j] == false){
				for(int k = j; k*j <= n; k++){
					prime[j*k] = true;
				}
			}
		}
		cnt = 0;
		for(int i = 1; i <= n; i++){
			if(prime[i] == false) cnt++;
		}
		
		cout << cnt << endl;
	}
}

C++: #include <iostream>
using namespace std;
bool isPrime(int n) {
    bool flag = false;
    if(n % 2 == 0) {
        if(n==2){
            flag=true;
        }
    }
    else {
        for(int i=2;i<n;i++) {
            if(n==i)break;
            else if(n % i==0){
                flag=false;break;
            }else flag=true;
        }
    }
    return flag;
}
int main(void){
    int n=0;
    int count = 0;
    while(cin>>n) {
        count = 0;
        for(int i=2;i<=n;i++) {
            if(isPrime(i))count++;
        }
        std::cout << count << std::endl;
    }
}

C++: #include<iostream>

using namespace std;

int n;
int prime[1000000];
int checked[1000000];
int primesum[1000000];
int result[30];
int datasets;

int main()
{
	prime[0] = 0;
	prime[1] = 0;
	prime[2] = 1;
	primesum[0] = 0;
	primesum[1] = 0;
	primesum[2] = 1;

	for(int a = 3;a<1000000;a++)
	{
		prime[a] = 1;
	}
	
	for(int a = 3;a<1000;a++)
	{
		if(checked[a] == 0)
		{
			checked[a] = 1;
			for(int b = 2;b<a;b++)
			{
				if(a%b==0)
				{
					prime[a] = 0;
					break;
				}
			}
			if(prime[a] == 1)
			{
				for(int c = 2*a ;c<1000000;c+=a)
				{
					checked[c] = 1;
					prime[c] = 0;
				}
			}
		}
	}

	for(int a = 3;a<100;a++)
	{
		primesum[a] = primesum[a-1]+=prime[a];
	}
	
	while(cin >> n)
	{
		cout << primesum[n] << endl;
	}

	return 0;
}

C++: 
#include <iostream>

using namespace std;

int main()
{
	int n, count,k;

	while(cin >> n){
		count = 1;
		k = 0;

		for(int i = 3; i <= n; i += 2){
			for(int j = 3; j <= std::sqrt((double)i); j += 2)
			{
				if(i%j == 0){
					k = 1;
					break;
				}
			}
			if(k == 0){
				count++;
			}
		}
		cout << count << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int n;

	while(cin >> n) {
		int count = 0;

		for(int i = 2; i <= n; i++) {
			int yaku = 0;
			for(int j = 1; j <= i; j++) {
				if(i % j == 0) {
					yaku++;
				}
			}
			if(yaku == 2) {
				count++;
			}
		}

		cout << count << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef long long ll;
 
ll mod_pow(ll x, ll n, ll mod){
  ll res = 1;
  while(n > 0){
    if(n & 1) res = res * x % mod;
    x = x*x % mod;
    n >>= 1;
  }
  return res;
}

ll mod_mul(ll x, ll n, ll mod){
  x %= mod;
  n %= mod;
  return x*n % mod;
}

bool millrr_rabin(ll n){
  if(n == 2) return true;
  if((n & 1) == 0 || n <= 1) return false;
  int a[] = {2, 3, 5, 7, 11, 13, 17, -1}, r;
  ll s = 0, d, x;
  d = n - 1;
  while((d & 1) == 0){
    s++;
    d = d >> 1;
  }
  
  for(int i = 0 ; a[i] != -1 && a[i] < n ; i++){
    if((x = mod_pow(a[i], d, n)) != 1){
      for(r = 0 ; r < s ; r++){
	if(x == n-1) break;
	x = mod_mul(x, x, n);
      }
      if(r == s) return false;
    }
  }
  return true;
}

int main(){
  int sum[1000010];
  sum[0] = 0;
  
  for(int i = 1 ; i <= 1000000 ; i++){
    sum[i] = sum[i-1];
    if(millrr_rabin(i)) sum[i]++;
  }
  
  int n;
  while(cin >> n){
    cout << sum[n] << endl;
  }
  
  
  return 0;
}

C++: #include <stdio.h>
  
int main(){
    int e[30];
  
    int k = 0;
    while( scanf( "%d",&e[k] ) != EOF )k++;
  
    for( int i = 0;i < k;i++ ){
        int n = 1;
        int k = 0;
        while( true ){
            if( e[k] >= n ){
                k++;
                n *= 10;
            } else {
                break;
            }
        }
        printf( "%d\n",k );
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
int n,a;
int ans;
while(cin>>n){
for(int i=2;i<n+1;i++){
for(int j=2;j<i;j++){
a=i%j;
if(a==0){ans++; break;}
}}
cout<<ans<<endl;}}

C++: #include<iostream>
#include<math.h>

using namespace std;

int main(){
    int n;
    bool p[1000000];
    while(cin>>n){
        int n_sq = (int)sqrt(n);
        for(int i=0; i<n; i++){
            p[i] = true;
        }
        p[0] = false;

        for(int i=1; i<n_sq; i++){
            if(p[i]){
                for(int j=i*2+1; j<n; j=j+(i+1)){
                    p[j] = false;
                }
            }
        }

        int cnt=0;
        for(int i=0; i<n; i++){
            if(p[i]){
                cnt++;
            }
        }

        cout<<cnt <<endl;

    }
    return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
 int main(){
    int n,cnt=0;
    cin >> n;
    vector<bool>m(n+1,true);
    for(int i=2;i*i<=n;i++)
         if(m[i]) for(int j=i+i;j<=n;j+=i)  m[j]=false;        
    for(int i=2;i<=n;i++)
            if(m[i]) { cnt++;}
    cout << cnt << endl;    
    return 0;
}

C++: #include<cstdio>
using namespace std;
bool prime[1000000];
#define max 1000000
int main(){
	prime[1] = true;
	for(int i = 2; i * i < max; i++){
		if(!prime[i]){
			for(int j = i * i; j < max; j+=i){
				prime[j] = true;
			}
		}
	}
	int n;
	while(scanf("%d",&n) != EOF){
		int ans = 0;
		for(int i = 1; i <= n; i++){
			if(!prime[i])ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

int prime(int n) {
	int k; int m[] = {2, 3, 5, 7, 11, 13,17, 19, 23, 29, 31, 37, 41};
	if(n == 2) return 1;
	if(n % 2 == 0) return 0;
for(k = 0; k < sizeof(m)/4; k++)
if(n % m[k] == 0) return 0;
	for(k = 3; k * k <= n; k += 2) {
		if(n % k == 0) return 0;
	}
	return 1;
}

int cntPrime(int n) {
	int cnt = 0, i, k;
	for(i = 2; i <= n; i++) {
		cnt += prime(i);
	}
	return cnt;
}

int main() {
	int a;
	int arg[1024] = { 0 };
	int cnt = 0;
	while(scanf("%d", &a) != EOF) {
		arg[cnt++]=a;
	}
	int i;
	for(i = 0; i < cnt; i++) {
printf("%d\n", cntPrime(arg[i]));
	}
}