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:
		return true
	case num < 2 || num%2 == 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>
using namespace std;
int isPrime[1000001];
int main(){

  fill(isPrime,isPrime+1000001,1);
  isPrime[0]=isPrime[1]=0;
  for(int i = 2 ; i*i < 1000001 ; i++ ){
    if(isPrime[i])for(int j=i*2 ; j < 1000001 ; j+=i)isPrime[j]=0;
  }
  int n;
  while(cin >> n){
    int cnt = 0;
    for(int i = 2 ; i <= n ; i++ ){
      if(isPrime[i])cnt++;
    }
    cout << cnt << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
int cnt,n,prime[10000007];
using namespace std;

void getprime()
{
	/*int tt=0,flag;
	prime[tt++]=2;
	for(int i=3;i<=1000000;i++) 
	{
		flag=1;
		for(int j=0;prime[j]*prime[j]<=i;j++)
		{
			if(i%prime[j]==0)
			{	
			    flag=0;
		     	break;
			}
		}
		if(flag==1) prime[tt++]=i;
	}*/
	memset(prime,0,sizeof(prime));  
    for(int i = 2; i<=10000007; i++)  
    {  
        if (!prime[i]) prime[++prime[0]] = i;  
        for(int j = 1;j<=prime[0] &&prime[j] < 10000007/i;j++ )  
        {  
            prime[prime[j]*i] = 1;  
            if(i%prime[j]==0) break;  
        }  
    } 
}

int main()
{	getprime();
	while(cin >> n)
	{
       for(int i=1;;i++)
	   {
       	if(prime[i]>n)
		   {
       		printf("%d\n",i-1);
       		break; 
		   }
	   }
    }
}

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

int main(void) { 
	int A[1000000];
	for(int i = 0; i < 1000000; i++){
		A[i] = 1;
	}
	A[0] = A[1] = 0;
	for(int i = 2; i < sqrt(1000000); i++){
	    if(A[i] == 1){
    		for(int j = 2; i * j < 1000000; j++){
                	A[i * j] = 0;
		    }
	    }
	}
	int n;
	while(cin >> n){ 
		int COUNT = 0;
		for(int i = 1; i <= n; i++){
            COUNT += A[i];
		}
		cout << COUNT << endl;
	}
	return 0; 
}

C++: #include <iostream>
using namespace std;
int main(){
    int a[80000];
    int n;
    a[0]=2;
    int k=1;
while(cin>>n){
    for(int i=3;i<=n;i++){
        for(int j=0;j<=k;j++){
            if(j==k){
                a[k]=i;
                k++;
                break;
             }
            if(i%a[j]==0)break;
        }
    }
    cout<<k<<endl;
    k=1;
 }
}

C++: #include<stdio.h>
int main ()
{
    int n,i,m,sum;
    while(1)
    {
        sum=0;
        scanf("%d",&n);
        for(m=2;m<=n;m++)
        {
            for(i=2;i<=m;i++)
            {
                if(m%i==0 && i<m)
                {
                    break;
                }
                if(i==m)
                {
                    sum=sum+1;
                }
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

C++: import numpy
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break
def primesfrom3to(n):
    sieve = numpy.ones(int(n/2), dtype=numpy.bool)
    if n%2 != 0:
        sieve = numpy.append(sieve,n/2)
    for i in range(3,int(n**0.5)+1,2):
        if sieve[int(i/2)]:
            sieve[int(i*i/2)::int(i)] = False
    return 2*numpy.nonzero(sieve)[0][1::]+1
if __name__ == "__main__":
    array = list(get_input())
    for i in range(int(len(array))):
        primeList = list(primesfrom3to(int(array[i])))
        primeList.insert(0,2)
        #print(primeList)
        print(len(primeList))

C++: #include <iostream>

using namespace std;

int vtoad(int);

int main(void){
	char	*val;
	int	c,N,ad;

	while(cin >> N){
		c=2;
		val = new char[N/3+2];
		for(int i=0;i<N/3+2;i++)
			val[i]=0;

		for(int i=1;i*6-1<=N;i++)
			for(int j=-1;j<=1;j+=2)
				if(i*6+j<=N&&(ad=vtoad(i*6+j)))
					if(!val[ad]){
						c++;
						for(int k=2;(i*6+j)*k<=N;k++)
							if(ad=vtoad((i*6+j)*k))
								val[ad]=1;
				}
		cout << c << endl;

		delete [] val;
	}

	return 0;
}

int vtoad(int val){
	if(!((val+1)%6))
		return (val+1)/3-1;
	else if(!((val-1)%6))
		return (val-1)/3+2;
	else
		return 0;
}

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

using namespace std;

vector<int>soe(int n);

int main(void)
{
	int num;
	while(cin >> num){
		vector<int>sosu(num);
		sosu = soe(num);
		int a_size = sosu.size();
		cout << a_size << endl;
		/*for(int i = 1; i < num; i++){
			cout << sosu[i] <<endl;
		}*/
	}	
	return 0;
}

vector<int>soe(int n){
	vector<int>hyo(n);
	for(int i = 2; i < n; i++){ //??\???
		hyo[i] = i;
	}
	for(int i = 2; i*i < n; i++){ //???????????§??°?????????
		if(hyo[i])
		for(int j = i*i; j < n; j += i){
			hyo.erase(remove(hyo.begin(), hyo.end(), j), hyo.end());
		}
	}
	hyo.erase(remove(hyo.begin(), hyo.end(), 0), hyo.end());
	hyo.erase(remove(hyo.begin(), hyo.end(), 1), hyo.end());
	return hyo;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
bool a[2000000];
signed main() {
	for (int i = 2; i < 2000000; i++) {
		a[i] = 1;
	}
	for (int i = 2; i < 2000000; i++) {
		if (!a[i]) continue;
		for (int j = 2 * i; j < 2000000; j += i) {
			a[j] = 0;
		}
	}
	int n;
	while (cin >> n) {
		int ans = 0;
		for (int i = 2; i <= n; i++) {
			ans += a[i];
		}
		cout << ans << endl;
	}
}