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<cstdio>
#include<iostream>
using namespace std;
int prime[1000000];
int main(){
    int n,ans=0;
    for(int i=0;i<1000000;i++)
        prime[i]=1;
    prime[1]=0;
    prime[2]=1;
    for(int i=1;i<1001;i++){
        if(prime[i]==1){
            for(int j=i+1;j<1000000;j++){
                if(j%i==0)
                    prime[j]=0;
            }
        }
    }
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        if(prime[i]==1)
        ans++;
    }
    printf("%d",ans);
    return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#define pb push_back
using namespace std;

int primes(int n) {
  int cnt=0;
  vector<bool> pri(n+1,false);
  for(int i=2;i<=n;i++) {
    if(pri[i]==false) {
      cnt++; pri[i]=true;
      for(int j=i*2;j<=n;j+=i) {
	pri[j]=true;
      }
    }
  }
  return cnt;
}


main() {
  int n;
  while(cin>>n) {
    cout << primes(n) << endl;
  }
}

C++: import java.util.Scanner;

public class Main {

    //?¨????????????????
    public int kazu(int num){

        //?´???°??????????????????????????°????????????
        int count = 0;
        //?´???°?????????????????????
        boolean result;

        for(int i = 2; i < num; i++){
            //?´???°??§????????¨?????????????????????
            result = true;
            for(int j = 2; j < i; j++){
                if(i % j == 0){
                    //?´???°???????????´????´???°??§??????
                    result = false;
                    break;
                }
            }
            //??????????????§?????????????´???°??¨??????????????????
            if(result)count++;
        }
        return count;
    }

    public static void main(String[] args){
    	Scanner sc = new Scanner (System.in);
        //?????????????????°???????´?????????????
        
        Main2 sosu = new Main2();
        int num = sc.nextInt();
        while(num < 100000){
        	System.out.println(sosu.kazu(num));
        	num = sc.nextInt();
        	
        }


    }

}

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

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

using namespace std;

vector<int> make_prime_list(int max_num){
    vector<bool> is_prime_list(max_num+1, true);
    for(int i=2; i <= sqrt(max_num); i++){
        if(is_prime_list[i]){
            for(int j=2; i*j <= max_num; j++){
                is_prime_list[i*j] = false;
            }
        }
    }

    int count = 0;
    vector<int> prime_list(max_num+1, 0);
    for(int i=2; i <= max_num; i++){
        if(is_prime_list[i]){
            count++;
        }
        prime_list[i] = count;
    }

    return prime_list;
}

int main(void){
    int input;

    vector<int> prime_list = make_prime_list(999999);

    while(cin >> input){
        cout << prime_list[input] << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 1e6+7;
int prime[maxn];
bool is_prime[maxn];
int n,p=-1;

void Eular()
{
    for(int i=1;i<=maxn-7;i++)
        is_prime[i]=true;
    for(int i=2;i<=maxn-7;i++)
    {
        if(is_prime[i])
            prime[++p]=i;
        for(int j=0;j<=p && i*prime[j] <= maxn-7;j++)
            is_prime[i*prime[j]]=false;
    }
}

int main()
{
    Eular();
    while(~scanf("%d",&n))
    {
        int i=0,ans=0;
        while(i<p && prime[i]<=n) i++,ans++;
        printf("%d\n",ans);
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a; i ++)
#define loop(i,b,a) for(int i = b ; i < a; i ++)
const int MAX = (1e8);
bool p[MAX];
void isPrime(){
  rep(i,MAX)p[i] = true;
  p[0] = p[1] = false;
  loop(i,2,MAX){
      if(p[i]){
      for(int j = i + i ; j < MAX ; j += i){
	p[j] = false;
      }
    }
  }
}

int main(void){
  isPrime();
  int n;
  while(cin>>n){
  int i = n-1;
  while(!p[i--]);
  cout<<++i<<' ';
  i = n + 1;
  while(!p[i++]);
  cout<<--i<<endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <math.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std; 
int main(){
	int N;
	double p = std::log2(N);
	while (cin >> N){
		int sum =0;
		cout << N*p << endl;
	}
	return 0;
}

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

bool check_prime(int n, vector<int>& prime_vector)
{
	if (n<=1)
		return false;
	if (n==2)
		return true;
	for (int i=0;i<prime_vector.size();i++)
		if (n%prime_vector[i]==0)
			return false;
	return true;
}

vector<int> make_prime(vector<int>& prime_vector, int n)
{
	for (int i=prime_vector[prime_vector.size()-1]+2;i<=n;i+=2)
		if (check_prime(i,prime_vector))
			prime_vector.push_back(i);

	return prime_vector;
}

int count_prime(vector<int>& prime_vector, int n)
{
	int count = 0;
	if (prime_vector[prime_vector.size()-1] >= n)
		for (int i=0;i<prime_vector.size();i++)  {
			count++;
			if (prime_vector[i] >= n) 
				break;		
		}
	else {
		make_prime(prime_vector,n);
		for (int i=0;i<prime_vector.size();i++)  {
			count++;
			if (prime_vector[i] >= n) 
				break;		
		}
	}

	return count;
}

int main()
{
	int n = 0;
	vector<int> result;
	vector<int> prime_vector;
	prime_vector.push_back(2);
	prime_vector.push_back(3);

	while(cin >> n) 
		result.push_back(count_prime(prime_vector,n));

	for(int i=0;i<result.size();i++)
		cout << result[i] << endl;
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int prime[1000000];
bool is_prime[1000001];

int sieve(int n){
  int p=0;
  for(int i=0;i<=n;i++) is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<=n;i++){
    if(is_prime[i]==true){
      prime[p++]=i;
      for(int j=2*i;j<=n;j+=i)is_prime[j]=false;
    }
  }
  return p;
}

int main(){
  int n;
  while(scanf("%d",&n)!=EOF)
    cout<<sieve(n)<<endl;
  return 0;
}

C++: ///
// File:  0009.cpp
// Author: ymiyamoto
//
// Created on Wed Nov  8 23:17:22 2017
//

#include <cmath>
#include <cstdint>
#include <iostream>

using namespace std;

bool is_prime(uint32_t val)
{
  for (uint32_t i = 2; i <= sqrt(val); i++) {
    if (val % i == 0) return false;
  }
  return true;
}

int32_t main()
{
  while (true) {
    uint64_t n;
    cin >> n;
    if (cin.eof()) break;

    uint32_t count = 0;
    for (uint32_t i = 2; i <= n; i++) {
      if (is_prime(i)) count++;
    }
    cout << count << endl;
  }

  return 0;
}

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

int main()
{
	int count=0,n;
	prime[0]=1;
	prime[1]=1;

	while(cin>>n)
	{
		int prime[1000001]={0};
		for(int i=2;i<=sqrt(n);i++)
			if(prime[i]==0)
				for(int j=i+1;j<=n;j++)
					if(i%j==0)
						prime[j]=1;
		for(int i=2;i<=n;i++)
			if(prime[i]==0)
				count++;
		cout<<count<<endl;
		count=0;
	}
}