Go: package main

// https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%E3%82%B9%E3%81%AE%E7%AF%A9

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		n, err := nextInt()
		if err != nil {
			break
		}
		maybePrime := make([]bool, n+1)
		for i := 0; i <= n; i++ {
			maybePrime[i] = true
		}

		maybePrime[0] = false
		maybePrime[1] = false
		for i := 2; i <= int(math.Sqrt(float64(n)))+1; i++ {
			j := i * 2
			for j <= n {
				maybePrime[j] = false
				j += i
			}
		}

		nPrimes := 0
		for _, p := range maybePrime {
			if p {
				nPrimes++
			}
		}
		// fmt.Println(maybePrime)
		fmt.Println(nPrimes)
	}
}

C++: #pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#define MAX 1000000
using namespace std;
int amount[MAX];
int vis[MAX];
int prime[MAX];
int main(){
	//memset(vis, 0, sizeof(vis));
	memset(prime, 1, sizeof(prime));
	prime[0] = prime[1] = 0;
	for (int i = 2; i*i<= MAX; i++){
		if (prime[i]){
			
			for (int j = i *i; j <= MAX; j += i){
				//vis[j] = 1;
				prime[j] = 0;
			}
		}
	}
	
	int n, m;
	while (cin >> n>>m){
		if (n==m) cout <<0 << endl;
		else {

		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <cstdlib>
using namespace std;

template <class T> int streamvar(std::istream& in, T& var)
{
    if (!in) {
        cerr << "invalid istream" << endl;
        return 1;
    }
    in >> var;
    if (in.fail()) {
        cerr << "no var" << endl;
        return 1;
    }
    return 0;
}
template <class T> int streamvec(std::istream& in, std::vector<T> &v)
{
    v.clear();
    string s;

    if (!in) {
        cerr << "invalid istream" << endl;
        return 1;
    }
    getline(in, s);
    if (in.fail()) {
        cerr << "no line" << endl;
        return 1;
    }
    istringstream is(s);
    while (1) {
        T tmp;
        is >> tmp;
        if (is.fail())
            break;
        v.push_back(tmp);
    }
    return 0;
}

#define NUM 1000000
int main(void)
{
    bool prime[NUM];
    int array[NUM] = {};
    for (int i = 0; i < NUM; i++) 
        prime[i] = 1;
    prime[0] = prime[1] = 0;

    for (int i = 0; i < NUM; i++) {
        if (prime[i]) {
            for (int j = i*2; j < NUM; j+=i) {
                prime[j] = 0;
            }
        }
    }
    array[0] = 0;
    for (int i = 1; i < NUM; i++) 
        array[i] = array[i-1] + prime[i];

    int n;
    while (cin >> n) {
        cout << array[n] << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define FOR(i, a, b)  for(int i=a; i<b; ++i)
#define rFOR(i, a, b) for(int i=a-1; i>=b; --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(a)  a.begin(), a.end()
using namespace std;

int main(){
  int n;
  while(cin >> n){
    int ans=0;
    vector<int> vec;
    vec.push_back(2);
    for(int i = 3; i<=n; i+=2){
      bool isPrimeN = true;
      REP(j, vec.size()){
        if(i%vec[j]==0){
           false;
        }
      }
      for(int j=3; j<=floor(sqrt(i)); j++){
        if(i%j==0){
          isPrimeN = false;
          break;
        }
      }
      if(isPrimeN){
        vec.push_back(i);
      }
    }
    cout << vec.size() << endl;;
  }
  return 0;
}

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

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

                return 0;
}

C++: #include <iostream>
using namespace std;
int a[1000000][2];
int main()
{
  int i,j,k,n;
  k = 0;
  for(i=2;i<1000000;i++){
    if(!a[i][0]){
      k++;
      for(j=2;i*j<1000000;j++){
	a[i*j][0] = 1;
      }
    }
    a[i][1] = k;
  }
  while(cin >> n){
    cout << a[n][1] << endl;
  }
  return 0;
}

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

using namespace std;

constexpr int MAX = 1000000;

int main()
{
    vector<bool> prime_list(MAX, true);
    prime_list.at(0) = false;
    prime_list.at(1) = false;
    for(int i = 2; i * i < MAX; ++i)
    {
        if(!prime_list.at(i))
            continue;
        for(int j = 2; i * j < MAX; ++j)
            prime_list.at(i * j) = false;
    }

    int num;
    int count;
    while(cin >> num)
    {
        count = 0;
        for(int i = 2; i <= num; ++i)
        {
            if(prime_list.at(i))
                count++;
        }
        cout << count << endl;
    }
}

C++: #include <stdio.h>

const int MAX = 999999;
int Prime[MAX];

void makePrimeList(int n) {
  Prime[0] = 1;
  int i, j;
  for (i = 2; i <= n / 2; i++) {
    for (j = 2; i * j <= n; j++) {
      Prime[i * j - 1] = 1;
    }
  }
}

int isPrime(int n) {
  if (Prime[n - 1] == 0) return 1;
  return 0;
}

int main() {
  
  int n, i, cnt, oldMax = 0;
  
  int init;
  for (init = 0; init <= MAX; init++) { Prime[init] = 0; }
  
  while(1) {
    if (scanf("%d", &n) == EOF) break;
    
    if (oldMax < n) {
      makePrimeList(n);
      oldMax = n;
    }
    cnt = 0;
    
    for (i = 1; i <= n; i++) {
      if (isPrime(i) == 1) cnt++;
    }
    
    printf("%d\n", cnt);
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
#define MAX_LIST 1000000

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

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

using namespace std;


int main(int argc, const char * argv[]) {
    // insert code here...
    
    int maxNumber;
    int countPrime=0;
    
    int prime[999999]={0};
    
    prime[0]=-1;
    prime[1]=-1;
    

        for(int i=2; i<1000000;i++){
            for(int j=2; j<i;j++){
                if(i%j==0){
                    prime[i]=-1;
                }
            }
        }
    
    

    while(cin >> maxNumber){
        countPrime=0;
        for(int x=2;x<maxNumber+1;x++){
            if(prime[x]==0){countPrime++;}
        }
        cout << countPrime << endl;
    }


    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


int main(){
    int n, ans, cnt, prime;

    while(cin >> n){
      prime = 1;
      for(int i=3; i <= n; i++){
        int j = 2;
        while(i%j !=0) j++;
        if(j == i) prime++;
      }
      cout << prime << endl;
    }
    return 0;
}