Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		flag := false
		count := 0

		for i := 2; i <= num; i++ { //1を除く入力値以下の数字
			for j := 2; j < i-1; j++ {
				if i%j == 0 && j != 1 {
					flag = true
					//fmt.Println(i, "/", j)
					break
				}
			}
			if !flag {
				count++
			} else {
				flag = false
			}
		}
		fmt.Println(count)
	}
}

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 << ansi << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
	unsigned int  n;
	cin >> n;
	unsigned  int num, count = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> num;
		for(int j = 2; j <=num; j++)
		{
			if(num == j)count++;
			if(num % j == 0)
			{
				break;
			}
		}
	}
	cout << count << endl;
	return 0;
}

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(void)
{
    int count=0;
    int i=1;
    int n=1;
    int number;
    // insert code here...
    while (cin >> number){
        while (n <= number){
            if(n == 1) {n++; continue;}
            while (i <= n) {
                if(i == 1) {i++; continue;}
                if(i == n) count++;
                if(n % i == 0) break;
                i++;
            }
            n++;
            i=1;
        }
        i=1;
        n=1;
        cout << count << endl;
        count = 0;
    }
    return 0;
}

C++: #include <cstdio>

int main(){
	int n;
	static bool c[1000000]={true};
	static int t[1000000];t[0] = 0;
	for(int i = 2;i < 1000000;i++){
		if(!c[i]){
		for(int j = 2;i*j < 1000000;j++){
			c[i*j] = true;
		}
		}
		t[i]=t[i-1]+!c[i];
	}
	/*for(int i = 1;i < 1000000;i++){
		if(c[i])t[i]=t[i-1];
		else t[i] = t[i-1]+1;
	}*/
	while(scanf("%d", &n)){
		printf("%d\n", t[n+1]);
	}
	return 0;
}

C++: 
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main(){
	int n,cnt=0,ans,sosu[100005]={0};
	for(int i=2;i<100000;i++){
		bool flag=true;
		for(int j=2;j<=sqrt(i);j++){
			if(i%j==0)flag=false;
		}
		if(flag){
		sosu[i]=1;
		}
	}
	while(cin>>n){
	ans=0,cnt=0;
	for(int i=2;i<=n;i++){
		if(sosu[i]==1){
		ans++;
		}
	}
	cout<<ans<<endl;
	}
    return 0;
}

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

using namespace std;

int main()
{
    vector<int> ans(0);
    bool p[999999]; for (int i=0; i<999999; i++) p[i]=true;
    p[1]=false;
    int sum=0, n;
    for (int i=2; i<998; i++)
    {
        for (int j=i+i; j<998; j+=i) p[j]=false;
    }
    while (cin>>n)
    {
        for (int i=1; i<=n; i++) if (p[i]) sum++;
        ans.push_back(sum);
        sum=0;
    }
    for (int i=0; i<ans.size(); i++) cout<<ans[i]<<'\n';
    return 0;
}

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

int main() {
int b[1000000];
for (int k=0;k<1000001;k++){
	b[k]=0;
}
b[2]=1;
b[3]=1;
b[4]=0;
b[5]=1;
b[6]=0;
b[7]=1;

for (int p=11;p<1000001;p+=2){
int i,a=0 ;
	i=3;
	while(i<=sqrt(p)){
		if(p%i==0){
			break;
	}i=i+2;
	}
	if (i>sqrt(p)){
		a=1;
	}
	b[p]=a;
}
int c[1000000];
for (int l=0;l<1000001;l++){
	c[l+1]=c[l]+b[l+1];
}
int r;
while(cin>>r){
	cout<<c[r]<<endl;
}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	bool num[1000000] = {0};
	for(int i=2; i<1000; i++){
		if(!num[i]){
			for(int j=i*i; j<1000000; j+=i){num[j] = true;}
		}
	}
	int n;
	while(cin >>n){
		int f = 0;
		for(int i=2; i<=n; i++){
			if(!num[i]){f++;}
		}
		cout <<f<<endl;
	}
}

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

bool sosuu[NUM+1] = {false};
int t = 0;
int out[30];

void Prime(int a)
{
	int count = 0;
	int x;
	x = floor(sqrt(a));
	for(int i = 2; i < x+1; i++){
		if(sosuu[i] == true){
			continue;
		}
		for(int j = 2*i; j < a+1; j = j+i){
			sosuu[j] = true;
		}
	}
	for(int i = 2; i < a+1; i++){
		if(sosuu[i] == false){
			count++;
		}
	}
	out[t] = count;
}

int main()
{
	int n;
	while(cin >> n){
		Prime(n);
		t++;
	}
	for(int i = 0; i < t; i++){
		cout << out[i] << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,n,i,j;
	for(int l=0;l<2;l++){
	cin>>a;
	n=0;
	for(i=2;i<=a;i++){
		for(j=2;j<i;j++){
			if(i%j==0)break;
		}
		if(i == j) n += 1;
	}
	cout<<n<<endl;
	}
}

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

bool is_prime(std::vector<int> &primes, int n){
	bool ret = true;
	int max_i = sqrt(n);

	for(int i = 0; i < primes.size(); i++){
		if(primes[i] > max_i){break;}
		if(n % primes[i] == 0){
			ret = false;
			break;
		}
	}
	return ret;
}

int main(int argc, char **argv){
	int n = 0;
	std::vector<int> primes;

	primes.push_back(2);

	while(std::cin >> n){
		int num_primes = 1;
		for(int i = 3; i <= n; i += 2){
			if(is_prime(primes, i)){
				num_primes++;
				if(i > primes.back()){
					primes.push_back(i);
				}
			}
		}

		std::cout << num_primes << std::endl;
	}
}