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 "bits/stdc++.h"
using namespace std;

int main() {
  int n;
  int sum=0;
  
  vector<int>primelist(1000010);
    primelist.at(2)=1;
    primelist.at(3)=1;
  
  for(int i=3;i<1000001;i++){
    for(int j=2;j<=sqrt(i);j++){
      
      if(i%j==0){
        primelist.at(i)=0;
        break;
      }
      primelist.at(i)=1;
    }
  }
  
  while(cin >> n){
  
  sum=0;
  for(int i=0;i<(n+1);i++){
    sum=sum+primelist.at(i);
  }
  
  
  cout <<sum<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <math.h>

using namespace std; 

int list[1000000]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163,
 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251,
 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557,
 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647,
 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757,
 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069};

long int a,b,loop,hasil,input,mid;
long int lo;
long int hi;

 bool Prima(unsigned long n) 
{
    for (unsigned short i = 0; list[i]*list[i] <= n; i++) 
	{
        if (n % list[i] == 0) 
		{
            return false;
        }
    }
 
    return true;
}

int main()
{
	lo=1087;
	a=180;
	while(lo<=1000003)
	{
		if(Prima(lo))
		{
			list[a]=lo;
			a++;
		}
		lo+=2;
	}
	//printf("%d",list[78498]);
	while(scanf("%ld",&input)!= EOF)
	{	
	lo=0;
	hi=78497;
	/*while(lo<=hi)
        {
            mid=(lo+hi)/2;
            if (list[mid]<input)
            {
                lo=mid+1; 
            } 
            else if(list[mid]>input)
            {
                hi=mid-1; 
            }
            else 
            {
                break; 
            } 
        }*/
	while(input>=list[lo])
	{
		lo++;
	}
	printf("%d\n",lo);
	}
	return 0; 
}

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

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

		for(i=2;i<n;i++){
			if(number[i]==false){
				ans++;
				for(m=i;m<n;m+=i){
					number[m]=true;
				}
			}
		}
		cout<<ans<<endl;
	}
}

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

vector <int> prime;
bool is_checked[1000010] = {false};

int main() {
	// Eratosthenes
	is_checked[0] = true; is_checked[1] = true;
	for(int i = 2; i < 1000000;i++){
		if (is_checked[i]) continue;
		prime.push_back(i);
		for(int j = 1;;j++) {
			if(i*j > 1000000) break;
			is_checked[i*j] = true;
		}
	}

	int n;
	while(cin >> n) {
		int count = 0;
		for (int i = 0;;i++) {
			if (prime[i] > n) break;
			count++;
		}
		cout << count << endl;
	}
	return 0;
}

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

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

int main(){
	int n;
	int a[10000];
	int b;
	int i, j, p;
	int c[30];
	p = 0;
	while (scanf("%d", &n) != EOF){
		b = (int)pow((double)n, 0.5);
		c[p] = 0;
		a[0] = -1;
		for (i = 2; i <= b; i++){
			for (j = 2; j <= n / i; j++){
				a[i*j - 1] = -1;
			}
		}
		for (i = 1; i <= n; i++){
			if (a[i - 1] != -1){ c[p]++; }
			a[i - 1] = 0;
		}
		p++;
	}
	for (i = 0; i < p; i++){
		printf("%d\n", c[i]);
	}
	return 0;
}

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

int main() {
	int N;
	bool is_prime[1000000];
	is_prime[0]=0; is_prime[1]=0;
	for(int i=2;i<1000000; i++){
		is_prime[i]=1;
	}
			
	for(int s=2; s<1000000; s++){
		if(is_prime[s]==1){	
		for(long long i=s*s; i<1000000; i+=s){
		is_prime[i]=0;	
			
		}
		}
	}
	
	while(cin >> N){
	
		int ans=0;
		for(int i=2; i<N+1; i++){
			ans+=is_prime[i];
		}
		cout << ans <<endl;
		
	}
return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	bool prime[1000010];
	memset(prime,1,1000010);
	prime[0]=prime[1]=0;
	int i,j,n,sum;
	for (i=2;i<1000000;i++)
	{
		if (prime[i])
		{
			for (j=2;i*j<1000000;j++)
			{
				prime[i*j]=false;
			}
		}
	}
	while(cin>>n)
	{
		sum=0;
		for(i=2;i<=n;i++)
		{
			sum+=prime[i];
		}
		cout<<sum<<endl;

	}	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

bool debug=false;
/*---------------------------------------------------*/


int prime[1000000];
bool is_prime[1000000];

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


int main(){
  int n,cnt;
  sieve();
  while(cin>>n){
    cnt=0;
    for(int i=0;;i++){
      if(prime[i]>n)break;
      cnt++;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

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

int main(){
	bool flag;
	int num, cou;
	
	while(cin >>num){
		cou = 0;
		for(int i = 3; i < num; i+= 2, flag = false){
			for(int j = 3; j < sqrt(num); j += 2){
				if(i % j == 0){
					flag = true;
					break;
				}
			}
			if(flag == false) cou++;
		}
		cout <<cou + 2<<endl;
	}
	
	return 0;
}

C++: __bowl1 = Array.new
__bowl2 = Array.new
__bowl3 = Array.new
__bowl4 = Array.new
__bowl5 = Array.new

india = gets.chomp.to_i
loop do
  srilanka = gets.chomp.to_i
  __bowl.push(srilanka)
  thai = gets.chomp.to_i
  puts __bowl.pop - thai

  india -= 1
  if india == 0
    break
  end
end

C++: #include<stdio.h>
#include<math.h>
int isprime(int x){
	int i;
	if(x == 2){
 		return 1;
	}
  	if(x<2||x%2==0){
		return 0;
	}
	i = 3;
	while( i <= sqrt(x) ){
		if(x%i==0){
			return 0;
		}
		i = i + 2;
	}
	return 1;
}
int main(){
	int l[999999]={0};
	int r=0,n;
	for(int i=0;i<999999;i++){
		if(isprime(i+1)){
			r++;
		}
		l[i]=r;
	}
	while(scanf("%d",&n)!=EOF){
		printf("%d\n",l[n-1]);
	}
	return 0;
}