Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var primeCount int
	for sc.Scan() {
		input := nextInt()
		for i := 0; i <= input; i++ {
			if IsPrime(i) {
				primeCount++
			}
		}
		fmt.Printf("%d\n", primeCount)
		primeCount = 0
	}
}

func IsPrime(num int) bool {
	switch {
	case num == 2 || num == 5:
		return true
	case num < 2 || num%2 == 0 || num%5 == 0:
		return false
	}
	sqrt := math.Sqrt(float64(num))
	for i := 3; i <= int(sqrt); i += 2 {
		if num%i == 0 {
			return false
		}
	}
	return true
}

func next() string {
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

C++: //Prime Number

#include<cstdio>
using namespace std;

int Isprime[1000000];
int prime[1000000];      //?´???°?????????????????????

//??¨??????????????????????????????????´???°?????????
void a_prime(){
    int n = 1000000;
    int p = 0;
    //??????????????§???????????????
    for(int i = 0; i < n; i++) Isprime[i] = 1;
    //0??¨1????´???°??§??????
    Isprime[0] = Isprime[1] = 0;
    for(int i = 2; i < n; i++){
        if(Isprime[i]) prime[p++] = i;
        for(int j = 2*i; j < n; j += i){
            Isprime[j] = 0;
        }
    }
    
    //?´???????????????£?????????
    for(int i = 1; i < n; i++) Isprime[i] += Isprime[i-1]; 
    
}


int main(void){
    int no;
    a_prime();
    while(scanf("%d", &no) != EOF){
        printf("%d\n", Isprime[no]);
    }
    
    return 0;
}

C++: #include<iostream>
#include<math.h>
#define MAX 100000
using namespace std;
int main(){
	bool p[MAX+1];
	int n,count;
	for(int i=2; i<=MAX; i++)
		p[i] = true;
	for(int i=2; i<=sqrt(MAX); i++){
		if(p[i] == true){
			for(int j=2*i; j<=MAX; j++){
				if(j%i == 0)
					p[j] = false;
			}
		}
	}
	while(cin >> n){
		count = 0;
		for(int i=0; i<=n; i++){
			if(p[i] == true)
				count++;
		}
		cout << count << endl;
	}
}

C++: #include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V + 1];
int sum[MAX_V + 1];
int main() {
  int i, k, v, n, max = 0;
  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;
      }
    }
  }
  while(scanf("%d", &n) != EOF){
    for(i = 2;i <= n;i++){
      sum[n] += prime[i];
    }
  printf("%d\n", sum[n]);
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
    int n = 999999;
    char* p;
    int t = 2;

   

    p = new char[n];
    for(int i = 0; i < n; i++) {
        p[i] = 1;
    }
    p[0] = p[1] = 0;
    
    for(int i = 3; i < n; i++) {
        if(p[i] == 0)
            continue;
        for(int point = 2; point < n; point += i) {
            p[point] = 0;        
        }
    }
    
    while(cin >> n) {
        int c = 0;
        for(int i = 1; i <= n; i++) {
            if(p[i]) {
                c++;
            }
        }
        cout  << c << endl;
    }



    return 0;
}

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

int main()
{
	long int n,m;
	while(cin>>n){
		long int i;
		int number[100000]={0};
		int ans=0;

		for(i=0;i<n;i++){
			if(number[i]==0){
				ans++;
				for(m=i;m<n;m+=i){
					number[m]=1;
				}
			}
		}
		cout<<ans<<endl;
	}
}

C++: /*
Volume0-0009
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>

#define N 1000000
#define TRUE (int)(0==0)
#define FALSE !TRUE
#define BUFLEN 1024

using namespace std;

int main(int argc, char *argv[]){
  int f[N];

  //  memset(f, TRUE, N);
  f[0]=FALSE;
  f[1]=FALSE;
  for (int i=2; i<N; i++)
    f[i] = TRUE;

  for (int i=2; i<N; i++){
    if (f[i] == TRUE ) {
      for (int j=i+i; j<N; j+=i){
	f[j] = FALSE;
      }
    }
  }

  while (cin >> int n) != NULL){
    int m = 0;
    for (i=1; i<=n; i++){
      if (f[i]){
	m++;
      }
    }
    cout << m;
  }
 
  exit(0);
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

vector<int> prime;
bool is_prime[1000010];
int sieve(int n) {
  fill(is_prime + 2, is_prime + 1000010, true);
  for (int i = 2; i <= n; i++) {
    if (is_prime[i]) {
      prime.emplace_back(i);
      for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
    }
  }
  return prime.size();
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  sieve(1000000);
  int n;
  while (cin >> n) {
    cout << upper_bound(prime.begin(), prime.end(), n) - prime.begin() << endl;
  }

  return 0;
}

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

int primes[78498], primepis[1000000], num_primes;
int calculated;
int main() {
	primes[0] = 2;
	primepis[2] = 1;
	calculated = 2;
	num_primes = 1;
	for (int i = 3; i <= 999999; i += 2) {
		bool is_prime = true;
		int max = (int)(sqrt(i)) + 1;
		for (int j=1; primes[j] < max && j<num_primes; j++) {
			if (i%primes[j] == 0) {
				is_prime = false;
				break;
			}
		}
		if (is_prime) {
			primes[num_primes++] = i;
			primepis[i] = primepis[i + 1] = primepis[i - 1] + 1;
		}
		else {
			primepis[i] = primepis[i + 1] = primepis[i - 1];
		}
	}
	while (true) {
		int n;
		if (!scanf("%d", &n)) break;
		printf("%d\n", primepis[n]);
	}
}

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

using namespace std;

bool isprime(int N)
{
	for (int I = 2; I <= sqrt(N); I++)
	{
		if (N % I == 0) return false;
	}

	return true;
}

int main()
{
	int n;

	int c = 0;

	cin >> n;

	for (int i = 2; i <= n; i++)
	{
		if (isprime(i) == true)
		{
			c += 1;
		}
	}

	cout << c << endl;

	return 0;
}

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

using namespace std;

vector<int> Prime;
void PrimeCalc()
{
	bool IsPrime[1000000];
	for(int i = 0; i < 1000000; ++i)
	{
		IsPrime[i] = true;
	}
	IsPrime[0] = IsPrime[1] = false;
	for(int i = 2; i < 1000000; ++i)
	{
		if(IsPrime[i])
		{
			Prime.push_back(i);
			for(int j = 2 * i; j < 1000000; j += i)
			{
				IsPrime[j] = false;
			}
		}
	}
}

void solve()
{
	PrimeCalc();
	int n;
	while(cin >> n)
	{
		int ans = 0;
		int pos = 0;
		for(int i = 0; i < Prime.size(); ++i)
		{
			if(Prime[i] <= n)
			{
				++ans;
			}
			else
			{
				break;
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	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++){
        cnt = 0;
        for(int j=2; j<i; j++){
          if(i%j==0) cnt++;
        }
        if(cnt==0) prime++;
      }
      cout << prime << endl;
    }
    return 0;
}

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

int Era(int N) {
	int prime_num = 0;
	int* array = new int[N + 1];
	for (int i = 2; i < N + 1; i++) {
		array[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (array[i]) {
			for (int j = 0; i*(j + 2) <= N; j++) {
				array[i*(j + 2)] = 0;
			}
		}
	}
	for (int i = 2; i < N + 1; i++) {
		if (array[i])prime_num++;
	}
	return prime_num;
}

void add(int* primes, int& now,int prime) {
	primes[now] = prime;
	now++;
}

int main() {
	int num;
	int primes[1000]; int now = 0;
	while (cin >> num) {
		add(primes, now, Era(num));
	}
	for (int i = 0; i < now; i++) {
		cout << primes[i] << endl;
	}
	return 0;
}