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>                                                                                                       
#include <vector>                                                                                                         
#include <list>                                                                                                           
                                                                                                                          
#define MAX 1000000                                                                                                       
                                                                                                                          
using namespace std;                                                                                                      
                                                                                                                          
int main() {                                                                                                              
  vector<int> prime_numbers;                                                                                              
  prime_numbers.push_back(2);                                                                                             
  prime_numbers.push_back(3);                                                                                             
  prime_numbers.push_back(5);                                                                                             
  prime_numbers.push_back(7);                                                                                             
                                                                                                                          
  list<int> search_list;                                                                                                  
  for (int i = 5; i < MAX; i++) {                                                                                         
    if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0 && i % 7 != 0) {                                                           
      search_list.push_back(i);                                                                                           
    }                                                                                                                     
  }                                                                                                                       
  int h = search_list.front();                                                                                            
  while (h * h < search_list.back()) {                                                                                    
    prime_numbers.push_back(h);                                                                                           
    list<int>::iterator itr = search_list.begin();                                                                        
    while (itr != search_list.end()) {                                                                                    
      if (*itr % h == 0) {                                                                                                
        itr = search_list.erase(itr);                                                                                     
      } else {                                                                                                            
        itr++;                                                                                                            
      }                                                                                                                   
    }                                                                                                                     
    h = search_list.front();                                                                                              
  }                                                                                                                       
  for (list<int>::iterator itr = search_list.begin(); itr != search_list.end(); itr++) {                                  
    prime_numbers.push_back(*itr);                                                                                        
  }                                                                                                                       
                                                                                                                          
  int n;                                                                                                                  
  while (cin >> n) {                                                                                                      
    int count = 0;                                                                                                        
    for (vector<int>::iterator itr = prime_numbers.begin(); itr != prime_numbers.end(); itr++) {                          
      if (*itr > n) break;                                                                                                
      count++;                                                                                                            
    }                                                                                                                     
    cout << count << endl;                                                                                                
  }                                                                                                                       
                                                                                                                          
  return 0;                                                                                                               
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

//----------------------------------
//----------------------------------

constexpr int64_t CALCNUM = 100000;

bool primes[CALCNUM];

signed main()
{
	for(int i = 0; i < CALCNUM; i++)
		primes[i] = true;
    ios::sync_with_stdio(false);
	vector<int> prime;

	for(int i = 2; i <CALCNUM ; i++)
	{
		if(primes[i])
		{
			prime.push_back(i);
			for(int j = 2 * i; j < CALCNUM; j += i)
				primes[j] = false;
		}
	}
	int n;
	while(cin >> n)
	{
		for(int i = 0; i < prime.size(); ++i)
			if(prime[i] > n){
				cout << i <<'\n'; break;
			}
	}
}