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 <cstring>
#include <algorithm>
using namespace std;

static bool sieve[1000010];
static int primecount[1000010];

int main() {
	fill(sieve, sieve+1000010, true);
	sieve[0]=sieve[1]=false;
	primecount[0]=primecount[1]=0;
	int partial_count = 0;
	for(int i = 2; i < 1000010; i++) {
		primecount[i] = partial_count;
		if(!sieve[i])continue;
		primecount[i] = ++partial_count;
		if(i<10000)
			for(int j = i*i; j < 1000010; j+=i) {
				sieve[j]=false;
			}
	}
	while(true) {
		int n; if(scanf("%d", &n)<1)break;
		printf("%d\n", primecount[n]);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
    int prime[80000];
    int ptr=2;
    prime[0] = 2;
    prime[1] = 3;
    for(int num=5; num<1000000; num+=2){
        bool f = false;
        for(int i = 0; i<ptr; i++){
            if (prime[i]*prime[i] > num) break;
            if (num%prime[i]==0) {
                f = true;
                break;
            }
        }
        if(!f) prime[ptr++] = num;
    }
    prime[ptr]=1000001;
    int n;
    while(cin >> n){
        int k=0;
        for(;prime[k]<=n;k++);
        cout << k << endl;
    }
     
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#define MAX_NUM 999999
int numbers[MAX_NUM] = {-1, -1};
int isPrime(int num) {
    int i;
    if(numbers[num]) {
        return 0;
    }
    for(i=num << 1; i<=MAX_NUM; i+=num) {
        numbers[i] = -1;
    }
    return 1;
}

int main() {
    int i, n, count;
    while(scanf("%d", &n) != EOF){
        count = 0;
        for(i=2; i<=n; ++i) {
            count += isPrime(i);
        }
        printf("%d\n", count);
    }
    return 0;
}

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

int main(void){
  int n;
  bool p[1000000];
  p[0] = p[1] = 0;
  p[2] = 1;
  int ans = 0;
  bool flag;
  for(int i = 0; i < 1000000; i++)
    p[i] = false;
  p[2] = true;
  for(int i = 3; i <= 1000000; i += 2){
    flag = true;
    for(int j = 3; j * j <= i; j += 2){
      if(i % j == 0){
	flag = false;
	break;
      }
    }
    if(flag)
      p[i] = true;
  }
  // cout << "end" << endl;
  while(cin >> n){
    int ans = 0;
    for(int i = 2; i < n; i++){
      if(p[i])
	ans++;
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
    int maxy = (int)sqrt(100000);
    int prime[100000];
    for(int i = 0; i < 100000; i++){
        prime[i] = 1;
    }
    prime[0] = prime[1] = 0;
    for(int i = 2; i <= maxy; i++){
        if(prime[i] == 1){
            for(int j=i*2; j <= maxy; j+=i){
                prime[j] = 0;
            }        
        }
    }
    int n;
    while(cin >> n){
        int ans = 0;
        for(int i=0; i <= n; i++){
            if(prime[i] == 1){
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  int n,flag=1,sum = 0;

  while(cin >> n){

    for(int i=2; i <= n; i++){
      if(i != 2 && i%2 == 0) flag = 0;
      else if(i != 3 && i%3 == 0) flag = 0;
      else if(i != 5 && i%5 == 0) flag = 0;
      else{
	for(int j=3; j < i/2; j+2){
	  if(i%j == 0 ) flag = 0;
	}
      }
      if(flag == 1) sum++;
      flag = 1;
    }
    cout << sum <<endl;
    sum = 0;
  }
}

C++: #include <stdio.h>

const int MAX_V = 100000;
int prime[MAX_V+1];

void init(){
    int i, k, v;
    for(i=2; i<MAX_V; i++){
        prime[i] = 1;
    }
    for(i=2; i*i<=MAX_V; i++){
        if(prime[i]){
            for(k=2*i; k<=MAX_V; k+=i){
                prime[k]=0;
            }
        }
    }   
}

int isprime(int n){
    return prime[n];
}

int main(){
    init();
    int num;
    while(scanf("%d", &num) != EOF){
        int count=0;
        for(int i=2; i<=num; i++){
            if(isprime(i)==1)
                count++;
        }
    printf("%d\n", count);
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAX_VALUE = 100007;
bool prime[MAX_VALUE];

int main() {
  FOR(i, 2, MAX_VALUE){
    if(prime[i]) continue;
    for(int j = i * 2; j<MAX_VALUE; j+=i)
      prime[j]=true;
  }

  int n;
  while(cin >> n) {
    int cnt = 0;
    FOR(i, 2, n + 1){
      if (!prime[i]) cnt++;
    }
    cout << cnt << endl;
  }
}