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    <iostream>
 
using namespace std;
 
bool F[1000003] = { false };
int DP[80000] = { 0 };
void prepa_Prime();
int count_Prime(int);
 
int main() {
    int n;

    prepa_Prime();
    while (cin >> n) {
        cout << count_Prime(n) << endl;;
    }
    return 0;
}
 
void prepa_Prime() {
    int i, c = 2;

    F[0] = F[1] = true;
    DP[0] = 1;

    DP[1] = 2;
    for (i = 4; i <= 1000003; i += 2) { F[i] = true; }
    
    for (i = 3; i <= 1000003; i += 2) {
        if (F[i] == false) {
            DP[c++] = i;
            for (int j = i * 2; j <= 1000003; j += i) {
                F[j] = true;
            }
        }
    }
}

int count_Prime(int n) {
    int i = 0;
    for (i; DP[i + 1] <= n; i++) {}
    return i;
}

C++: #include <iostream>
using namespace std;
int main() {
  int n;
  while(cin >> n) {
	int cnt = 0;
	for(int i = 0; i <= 9; ++i) {
	  if(i > n) break;
	  for(int j = 0; j <= 9; ++j) {
		if(i+j > n) break;
		for(int k = 0; k <= 9; ++k) {
		  if(i+j+k > n) break;
		  for(int l = 0; l <= 9; ++l) {
			if(i+j+k+l > n) break;
			else if((i+j+k+l) == n) cnt++;
		  }
		}
	  }
	}
	cout << cnt << endl;
  }
  return 0;
}

C++: #include<stdio.h>
const int MAX_V = 10000;
int prime[MAX_V+1],sum[MAX_V+1];
int main(void){
    int i,k,n,ans;
    for(i = 0; i < MAX_V + 1; i ++){
        prime[i] = 1;
        sum[i] = 0;
    }
    prime[0] = 0;
    prime[1] = 0;
    for(i = 2; i * i < MAX_V; i ++){
        if(prime[i]){
            for(k = 2 * i; k < MAX_V; k += i){
                prime[k] = 0;
            }
        }
    }
    for(i = 2; i < MAX_V; i ++){
        sum[i+1] = sum[i] + prime[i];
    }
    while(scanf("%d",&n) != EOF){
        ans = sum[n+1];
        printf("%d\n",ans);
    }
    return 0;
}

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

int main(){
	int n,count = 0;

	cin >> n;
	int *arr = new int[n];

	for(int i = 0; i < n + 1; i++) arr[i] = 1;

	for(int i = 2; i < sqrt(n); i++){
		if(arr[i]) {
			for(int j = 0; i * (j + 2) <= n; j++) {
				arr[i * (j + 2)] = 0;
			}
		}
	}
	for(int i = 2; i <= n; i++){
		if(arr[i]) count++;
	}

	cout << count << "\n";

	delete[] arr;
}

C++: #include<iostream>
#include<cmath>

using namespace std;

int isprime(int x){
	int i;
	for(i = 3; i <= sqrt(x); i += 2){
		if(x % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n, i, count;
	while(cin >> n){
		count = 0;
		for(i = 2; i <= n; i++){
			if(i == 2 || i == 3) count++;
			else if(isprime(i) == 1 && i % 2 != 0) count++;
		}
		cout << count << endl;
	}
	return 0;
}

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

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

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

using namespace std;

int main(){
	int n,i,j,buf,cnt;
	bool flag;

	while(cin >> n){
		cnt = 1;
		for(i=3;i<=n;i+=2){
			flag = false;
			buf = (int)sqrt((double)i);

			for(j=3;j<=buf;j+=2){
				if((i % j) == 0){
					flag = true;
					break;
				}
			}

			if(flag == false){
				cnt++;
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

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

int main(){
    int n, cnt;
    bool prime[1000000];
    prime[0] = prime[1] = false;
    
    for(int i = 2;i <= 1000000;i++){
        prime[i] = true;
    }

    while(cin >> n){
        cnt = 0;
        
        for(int i = 2;i <= sqrt(n);i++){
            if(prime[i]){
                for(int j = 2*i;j<= n;j++){
                    if(j%i == 0){
                        prime[j] = false;
                    }
                }
            }
        }
        
        for(int i = 2;i <= n;i++){
            if(prime[i]){
                cnt++;
            }
        }
        
        cout << cnt << endl;
    }

    return 0;
}

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

#define Max 999999

int main(){
	bool is_prime[Max+1];
	for(int i=0;i<=Max;i++)is_prime[i]=true;
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=Max;i++){
		if(is_prime[i]){
			for(int j=i*2;j<=Max;j+=i)is_prime[j]=false;
		}
	}
	int n;
	while(std::cin>>n){
		int count=0;
		for(int i=2;i<=n;i++){
			if(is_prime[i])count++;
		}
		std::cout<<count<<std::endl;
	}
	return 0;
}

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

	int kotae = 1;
	for ( int i = 3; i < n; i += 2 )
	{
		if ( p[i] )
			kotae++;
	}

	cout << kotae << endl;

	return 0;
}

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

vector<int> sieve;

void make_prime(){
  bool a[1000001];
  for(int i = 0; i <= 1e6; i++)a[i] = false;
  a[0] = true;
  a[1] = true;
  for(int i = 2; i <= 1e6; i++){
    if(a[i])continue;
    sieve.push_back(i);
    for(int j = i; j <= 1e6; j += i){
      a[j] = true;
    }
  }
}

int main(){
  int n;
  make_prime();
  while(cin >> n){
    int cnt = 0;
    for(int i = 0; sieve[i] <= n; i++)cnt++;
    cout << cnt << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include <cstring>
using namespace std;
int main()
{
	    int n;
		bool a[1000001]; 
		memset(a,0,sizeof(a));
		for(int i=2;i<=1000;++i)
		{
			for(int j=2;j*i<=1000000;++j)
			{
				a[i*j]=1;
			}
		}

	while(cin>>n)
	{
		int count=0;
		for(int k=2;k<=n;k++)
		{
			if(!a[k])
			count++;
		}
		cout<<count<<endl;
	
	
		
	}
	return 0;
}

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

using namespace std;

int main()
{ 
	int n;
	while (cin >> n)
	{
		vector<bool> a(n + 1, true);
		int cnt = n == 0 ? 0 : n - 1;

		// Sieve of Eratosthenes
		for (int i = 2; i*i < n; ++i)
			if (a[i])
				for (int j = 0; i * (j + 2) <= n; ++j)
					if (a[i * (j + 2)]) a[i * (j + 2)] = false, cnt--;

		cout << cnt << endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<stack>
#include<queue>
#include<ctype.h>
#include<math.h>
#include<map>
#include<time.h>
using namespace std;
const int N=1e6;
int isprime[N];
int prefixsum[N];
int SQRT=ceil(sqrt((double)N));		//返回大于或者等于指定表达式的最小整数 
int prime()
{
	memset(isprime,1,sizeof(isprime));
	int i;
	isprime[0]=isprime[1]=0;
	for(i=0;i<=SQRT;i++)
	{
		if(isprime[i])
		{
			for(int j=i*i;j<=N;j+=i)
			{
				isprime[j]=0;
			}
		}
	}
}
void maketable()
{
	for(int i=1;i<N;i++)
	{
		prefixsum[i]=isprime[i]?prefixsum[i-1]+1:prefixsum[i-1];
	}
} 
int main()
{
	prime();
	maketable();
//	printf("%.2f\n",(double)clock()/CLOCKS_PER_SEC);
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		printf("%d\n",prefixsum[n]);
	}
	return 0;
}