Go: package main

import (
        "fmt"
)

const MAX int = 1000000
var primes [MAX]int

func main() {
        Init()
        var n, cnt int
        for {
                _, err := fmt.Scanf("%d", &n)
                if err != nil {
                        break
                }
                cnt = 0
                for i := 2; i <= n; i++ {
                        cnt += primes[i]
                }
                fmt.Printf("%d\n", cnt)
        }
}

func Init() {
        for i := 0; i < MAX; i++ {
                primes[i] = 1
        }
        primes[0] = 0
        primes[1] = 0
        Soe()
}

func Soe() {
        for i := 2; i < MAX; i++ {
                if primes[i] > 0 {
                        for j := i*2; j < MAX; j+=i {
                                primes[j] = 0
                        }
                }
        }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
int lcm(int a,int b){if(a==0){return b;} return a/gcd(a,b)*b;}
long long MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

bool isprime(int n){
  if(n==2||n==3) return true;
  for(int i=2; i*i<=n; i++) if(n%i==0) return false;
  return true;
}

signed main(){
  int n;
  while(cin>>n&&n){
    if(n==1){cout<<0<<en; RE;}
    int ans=0;
    for(int i=2; i<=n; i++){
      if(isprime(i)) ans++;
    }
    cout<<ans<<en;
  }
}

C++: #include<iostream>

using namespace std;

int main(){
  int n,flag=1,sum = 0;

  while(cin >> n){
    if(n == 1) cout << 0;

    for(int i=2; i <= n; i++){
      for(int j=2; j < i; j++){
	if(i%j == 0 ) flag = 0;
      }
      if(flag == 1) sum++;
      flag = 1;
    }
    cout << sum <<endl;
    sum = 0;
  }
}

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

int main()
{
	int counter=0,n,flag;
	
	while(cin>>n)
	{
		if(n<=1) 
		{
			cout<<'0'<<endl;
			break;
		}

		for(int i=3;i<=n;i+=2)
		{
			flag=1;
			for(int j=3;j<=sqrt(n);j+=2)
				if(i%j==0)
				{
					flag=0;
					break;
				}
			if(flag==1)
				counter++;
		}
		cout<<counter<<endl;
	}
}

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

int main()
{
	int n, i, j, count;

	while(scanf("%d", &n) != EOF){
		count = n - 1;

		for (i = 2; i <= n; i++){
			for (j = 2; j <= sqrt(i); j++){
				if(i%j == 0) {count--; break;}
			}
		}

		printf("%d\n", count);
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long long n, a, b,c;
	b = 0;
	while (cin >> a) {
		for (c = 1; c <=a; c++) {
			for (int j = 2; j*j <= c; j++) {
				if (c%j == 0) {
					b++;
					break;
				}
			}
		}
		cout << a - b - 1 << endl;
		b = 0;
	}
	return 0;
}

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

int main() {
	int n;
	while(cin >> n && n != EOF) {
		bool* prime = new bool[n+1];
		int count = 0;
		for(int i = 2; i <= n; ++i) {
			prime[i] = true;
		}
		prime[0] = prime[1] = false;
		
		for(int i = 0; i <= n; ++i) {
			if(prime[i]) {
				for(int j = 2 * i; j < n; j += i) {
					prime[j] = false;
				}
			}
		}
		
		for(int i = 0; i <= n; ++i) {
			if(prime[i]) {
				count++;
			}
		}
		
		cout << count << endl;
		delete[] prime;
	}
}

C++: #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define N 999999
char num[N];
void furui(){
  int i, divide;
  for(i = 0; i < N; i++){
    num[i] = 1;
  }
  num[0] = 0;
  num[1] = 0;
  for(divide = 2; divide <= sqrt(N); divide++){
    if(num[divide] == 0) continue;
    for( i = 0; i < N; i++){
      if(i % divide == 0){
        num[i] = 0;
      }
    }
    num[divide] = 1;
  }
}

int main(void){
  int c, i, j;
  char buf[7];
  long int n;
  long int count = 0L;

  furui();

  for(j = 0; j < 30; j++){
    for(i = 0; ;i++){
      c = getchar();
      if(c == EOF || c == '\n'){
        buf[i] = '\0';
        break;
      }
      buf[i] = c;
    }
    n = atol(buf);
    for(i = 1; i <= n; i++){
      if(num[i] == 1) count++;
    }
    printf("%ld\n", count);
    if(c == EOF) break;
  }
  return 0;
}

C++: #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> prime;
void init(){
	for(int i=2;i<999999;i++){
		bool isprime=true;
		for(vector<int>::iterator p(prime.begin());p!=prime.end();p++){
			if(i%*p==0){
				isprime=false;
				break;
			}
		}
		if(isprime){
			prime.push_back(i);
		}
	}
}
int main(){
	int n;
	init();
	while(cin>>n){
		cout<<lower_bound(prime.begin(),prime.end(),n)-prime.begin()+1<<endl;
	}
	return 0;
}

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

bool isp[max];
int ans[max]={};

void sieve(){
	for(int i=0;i<max;i++)isp[i]=true;
	for(int i=2;i<max;i++){
		if(isp[i]){
			ans[i]++;
			for(int j=2*i;j<max;j+=i)isp[j]=false;
		}
	}
	for(int i=1;i<max;i++)ans[i]+=ans[i-1];
	return;
}

int main()
{
	int n;

	sieve();
	while(cin>>n)cout<<ans[n]<<endl;

	return 0;
}

C++: #include<iostream>
 
using namespace std;
 
int main(){
  static bool cmp[1000000]={true};
  static int npr[1000000];
  for(int i=2;i<1000000;i++){
    if(!cmp[i]){
      for(int j=2;j*i<1000000;j++){
    cmp[i*j]=true;
      }
    }
    npr[i]=npr[i-1]+!cmp[i];
  }
  for(int n;cin>>n;n++){
    cout<<npr[n]<<endl;
  }
  return 0;
}

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

int prime(int data){
	int i;
	if(data%2 == 0){
		return 0;
	}
	for(i = 3;i < sqrt(data);i+=2){
		if(data%i == 0){
			return 0;
		}
	}
	return 1;
}

int main(void){
	int data,cnt=0,i;
	while(std::cin >> data){
		if(data > 1)cnt = 1;
		for(i=3;i<=data;i++){
			if(prime(i)){
				cnt++;
			}
		}
		std::cout << cnt << std::endl;
	}
}

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

int main()
{

	int n;
	while (cin >> n) {
		int C = 0;
		bool prime[1000000] = { 0 };
		// 0????´???°
		prime[1] = 1;
		prime[2] = 0;

		for (int j = 2; j * j <= n; j++) {
			if (prime[j] ==0) {
				for (int k = 2; k*j <= n; k++) {
					prime[j*k] = 1;
				}
			}
		}
		for (int i = 1; i <= n; i++) {
			if (prime[i] == 0)
				C++;
		}
		cout << C << endl;
	}
	return 0;
}

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

int main(void)
{
    int count=0;
    int i=1;
    int n=1;
    int number;
    int a[30]={0};
    int j=0;
    // 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;
        j++;
        a[j] = count;
    }
    
    for(int i=0;i<j;i++){
        cout << a[j] << endl;
    }
    return 0;
}

C++: /*
	大号水?，拿来?手
*/
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;

int Find_Number (int x)
{
	int cnt = 0;
	for (int i=2;i<=x;i++)
	{
		bool flag = false;
		for (int j=2;j<=sqrt((double)i);j++)
		{
			if ( i % j == 0)
			{
				flag = true;
				break;
			}
		}
		if (flag == false )
		{
			cnt++;
		}
	}
	return cnt;
}

int main ()
{
	int N;
	scanf("%d",&N);
	cout<<Find_Number (N)<<endl;
	return 0;
}