Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var primeCount int
	for sc.Scan() {
		input := nextInt()
		for i := 0; i <= input; i++ {
			if IsPrime(i) {
				primeCount++
			}
		}
		fmt.Printf("%d\n", primeCount)
		primeCount = 0
	}
}

func IsPrime(num int) bool {
	switch {
	case num == 2 || num == 5:
		return true
	case num < 2 || num%2 == 0 || num%5 == 0:
		return false
	}
	sqrt := math.Sqrt(float64(num))
	for i := 3; i <= int(sqrt); i += 2 {
		if num%i == 0 {
			return false
		}
	}
	return true
}

func next() string {
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

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

using namespace std;

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

int sosuu(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]){
            prime[p++]=i;
            for (int j=i*2; j<=n; j+=i) {
                is_prime[j]=false;
            }
        }
    }
    return p;
}

int main(void){
    int n;
    cin>>n;
    cout<<sosuu(n)<<endl;
    return 0;
}

C++: #ifndef VS
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<math.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {
	cww() { CIN_ONLY{ ios::sync_with_stdio(false); cin.tie(0); } }
}star;
#define DEBUG if(0)
#endif

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r) { bool a = l>r; if (a)l = r; return a; }
template <typename T>inline bool chmax(T &l, T r) { bool a = l<r; if (a)l = r; return a; }
namespace prime {
	const int size = 1123456;
	int p[size];
	struct prime {
		prime(){
			REP(i, size)p[i] = 1;
			p[0] = p[1] = 0;
			REP(i, size)if (p[i]) {
				for (int j = i + i; j < size; j += i)p[j] = 0;
			}
			FOR(i, 1, size) {
				p[i] += p[i - 1];
			}
		}
	}prime_init;
}
int main() {
	int n;
	while (cin >> n) {
		cout << prime::p[n] << endl;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
using ppa = pair<pa,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

//4??????
//int dy[]={0, 1, 0, -1};
//int dx[]={1, 0, -1, 0};

//8??????
//int dy[]={0,0,1,-1,1,1,-1,-1};
//int dx[]={1,-1,0,0,1,-1,1,-1};

const ll MOD = 1000000007;

ll pow_mod(ll a,ll b,ll mod){
    ll tmp = 1;
    a %= mod;
    if(b > 0){
        tmp = pow_mod(a, b/2, mod);
        if(b % 2) tmp = (((tmp*tmp)%mod)*a)%mod;
        else tmp = (tmp*tmp)%mod;
    }
    return tmp;
}

int mm = 1000000;
vector<bool> d(mm,true);

void hoge(){
    d[0] = d[1] = false;
    FOR(i,2,mm){
        for(int j = 2; i*j <= mm; j++){
            d[i*j] = false;
        }
    }
}

void solve() {
    vector<int> dp(mm,INF);
    int val;
    int m = 2;
    dp[0] = dp[1] = 0;
    hoge();
    while(cin >> val){
        if(dp[val] == INF){
            FOR(i,m,val+1){
                dp[i] = dp[i-1] + (d[i] ? 1 : 0);
            }
            m = val;
        }
        cout << dp[val] << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    solve();

    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
int main(){
	int n;
	while(cin >> n){
		vector<int> vec;
		vector<int>::iterator it =vec.begin();
		for(int i=2;i<=n;i++){
			int flag=0;
			it =vec.begin();
			while(it!= vec.end()){
				if(i% *it==0){
					flag=1;
					break;
				}
				it++;
			}
			if(!flag)vec.push_back(i);
		}
		it =vec.begin();
		//while(it!= vec.end()){
		//	cout<<*it<<endl;
		//	it++;
		//}
		cout << vec.size()<<endl;
	}
	return 0;
}

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

int main(){
	int n;
	int *prime,i,j;
	int count;
	bool flag;
	//for(i=1;i<1000000;i++)n[i]=1;

	while((cin >> n)!= NULL){
		count = 0;
		prime = new int[(int)sqrt(n)+1];
		for(i = 3; i <= n; i+=2){
			flag = true;
			for(j = 0; j < count; j++){
				if(i % prime[j] == 0){
					flag = false;
					break;
				}
			}
			if(flag == true){
				prime[count++] = i;
			}
		}
		if(n > 1)	count++; //2

		cout << count << endl;

		delete prime;
	}
//	while(1);
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	int i,j,n;
	bool prime[1000001];
	for (i = 3; i <= 1000000; i += 2){
		prime[i] = true;
	}
	prime[2] = true;

	for (i = 3; i <= 1000; i += 2){
		if (prime[i] == 1){
			for (j = 3; j <= 1000000 / i; j += 2){
				prime[i * j] = false;
			}
		}
	}
	while(cin >> n && n){
		int count = 0;
		for(i=2;i<=n;i++){
			if(prime[i] == true) count++;
		}
		cout << count << endl;
	}

	return 0;
}

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

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

C++: #include<iostream>
using namespace std;
bool pd(int x)
{
	int i,j;
	int flag=1;
	for(i=2;i<x;i++)
	{
		if(x%i==0)
		{
			flag=0;
		}
	}
	if(flag)
	return true;
	else return false;
}
int main()
{
	int n;
	while((scanf("%d",&n))!=EOF)
	{
		int i,j,k;
		k=0;
		for(i=2;i<=n;i++)
		{
			if(pd(i))
			{
				k++;
			}
		}
		printf("%d\n",k);
	}
	return 0;
}

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 < i; j++){
				if(i%j == 0) {count--; break;}
			}
		}

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

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int gurobal[1000001]={0};
int main(void)
{
	int n=0;
	int i=0,j=0;
	int heihoukon=0;
	int count=0;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		gurobal[1]=0;
		for (i=2;i<=n;i++)
		{
			gurobal[i]=1;
		}
		(int)heihoukon=sqrt((double)n);
		for (i=2;i<=heihoukon;i++)
		{
			if (gurobal[i]!=0)
			{
				for (j=i*2;j<=n;j+=i)
				{
					gurobal[j]=0;
				}
			}
		}
		for (i=2;i<=n;i++)
		{
			if (gurobal[i]!=0)
			{
				count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main() {
	int n, count = 0;
	double l, m;
	while(cin >> n) {
		for(int i = 2; i <= n; i++) {
			count++;
			int j;
			l = sqrt(i * 1.0);
			m = l;
			for(j = 2; j <= m; j++) {
				if(i % j == 0) {
					count--;
					break;
				}
			}
		}
		cout << count << endl;
		count = 0;
	}

	return 0;
}