Go: package main

import "fmt"

func main() {
	const MAX = 1000000
	prime := make([]int, MAX, MAX)
	check := make([]int, MAX, MAX)
	count := make([]int, MAX, MAX)

	prime[0] = 1
	prime[1] = 1

	// prime init
	for i := 2; i < MAX; i++ {
		if check[i] == 1 {
			continue
		}

		if prime[i] == 0 {
			for j := i * 2; j < MAX; j += i {
				check[j] = 1
				prime[j] = 1
			}
		}
	}

	for i := 2; i < MAX; i++ {
		cnt := 0

		if prime[i] == 0 {
			cnt = 1
		}

		count[i] = count[i-1] + cnt
	}

	for {
		var input int
		inputCount, _ := fmt.Scanf("%d", &input)
		if inputCount != 1 {
			break
		}

		fmt.Println(count[input])
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	long long int N,count=0;
	while(cin >> N){
		count = 0;
		if(N<0)	break;
	for(int x=2;x<=N;x++){
		int flag = 0;
		for(int y=2;y<x;y++){
			if((x%y)==0)	flag = 1;
		}
		if(flag == 0)	count++;
	}
	cout << count << endl;
	}
	return 0;
}

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

int sosu(long x){
	int a=1;
	long b,c,d;
	d=sqrt(x);
	for(b=3;b<=d;b=b+2){
		c=x%b;
		if(c==0){
			a=0;
			break;
		}
	}
	return (a);
}

int main(void){
	int y,z;
	long i,j,k,n;
	long f[168];
	j=0;
	for(i=3;i<=10000;i=i+2){
		if(sosu(i) == 1){
			f[j]=i;
			j++;
			if(j==168)break;
		}
	}
	for(i=0;i<168;i++){
//		printf("%ld\n",f[i]);
	}
	while(scanf("%d",&n) != EOF){
		z=1;
		for(i=3;i<=n;i=i+2){
			y=1;
			for(j=0;j<168;j++){
				if(i==f[j]) break;
				else k=i%f[j];
				if(k==0){
					y=0;
					break;
				}
			}
			z=z+y;
		} 
		if(n==1) printf("0\n");
		else printf("%d\n",z);
	}
	return 0;
}

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

#define N 1000000

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

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

int main(){
	int cnt, x, n, i, j;
	bool flg;
	double rootx;
	int rootintx;
	while(cin>>n){
		cnt=0;
		if(n>=2)cnt++;
		for(x=3;x<=n;x+=2){
			flg = true;
			if(x==2){
				cnt++;
				continue;
			}
			if(x<2 || !(x%2)){
				continue;
			}
			rootx = sqrt(x);
			rootx = ceil(rootx);
			rootintx = int(rootx);
			for(j=2;j<=rootintx;j++){
				if(!(x%j)){
					flg=false;
					break;
				}
			}
			if(flg)cnt++;
		}
		cout<<cnt<<endl;;
	}
	return 0;
}

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

using namespace std;

int main(void){
	int num = 0;
	vector<int> vec;
	while (cin >> num){
		int count = 0;
		bool hantei = true;
		for (int i=2; i<num; ++i){
			for (int j=2; j<i; ++j){
				if ((i%j) == 0){
					hantei = false;
					break;
				}
			}
			if (hantei == true){
				++count;
			}
		}
		vec.push_back(count);
	}
	vector<int>::iterator it = vec.begin();
	while(it != vec.end()){
		cout << *it << endl;
		++it;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;


int main(){
	int n=0,m=0,o=0,f=0,c=0;

	while(cin>>n){
		c=0;

	for(o=2;o<=n;o++)
	{	f=0;
		for(m=2;m<o/2;m++){
			if(o%m == 0){f++;}

		};
		if(f==0){c++;};

	};
	cout<<c<<endl;
	};
 return 0;

}

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

using namespace std;

int main() {
	int n;

	while (cin >> n) {
		int counter = 1;
		
		if(n < 1000){
			for (int i = 3; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		}else if(n < 10000){
			counter = 168;
			for (int i = 1001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 100000){
			counter = 1229;
			for (int i = 10001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 200000){
			counter = 9592;
			for (int i = 100001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 300000){
			counter = 17984;
			for (int i = 200001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 400000){
			counter = 25997;
			for (int i = 300001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 500000){
			counter = 33860;
			for (int i = 400001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 600000){
			counter = 41538;
			for (int i = 500001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 700000){
			counter = 49098;
			for (int i = 600001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 800000){
			counter = 56543;
			for (int i = 700001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if(n < 900000){
			counter = 63951;
			for (int i = 800001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else if (n < 999999){
			counter = 71274;
			for (int i = 900001; i <= n; i=i+2) {
				int kari = 1;
				for (int j = 3; j < i; j=j+2) {
					kari = i % j;
					if(kari == 0) {
						break;
					}
				} if (kari != 0) {
					counter++;
				}
			}
		} else {
			counter = 78498;
		}
		cout << counter << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int shusu[35];
	int d=0;
	for(int i=2;;i++)
	{
		int bj=1;
		for(int j=2;j<=sqrt(i);j++)
		{
			if(i%j==0)
			{
				bj=0;
				break;
			}
		}
		if(bj==1)
		{
			shusu[d++]=i;
		}
		if(d==35)
		{
			break;
		}
	}
	int n;
	while(cin>>n)
	{
		for(int i=0;i<35;i++)
		{
			if(n<2)
			{
				cout<<0<<endl;
				break;
			}
			if(n>=shusu[i] && n<shusu[i+1])
			{
				cout<<i+1<<endl;
				break;
			}
		}
	} 
	return 0;
}

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

void AOJ0009()
{
	int n = 0;
	int prime[1000];
	int count = 0;
	for (int i = 2; i <= 1000; i++)
	{
		int j = 2;
		bool flag = false;
		for (j = 2; j <= i; j++)
		{
			if (i % j == 0)
				break;
		}
		if (i == j)
		{
			prime[count] = i;
			count++;
		}
	}

	while (cin >> n)
	{
		count = 0;
		while (prime[count] <= n)
		{
			count++;
		}
		cout << count << endl;
	}
}
int main()
{
	//AOJ0005();
	//AOJ0007();
	AOJ0009();
	return 0;
}