Go: package main

import (
  "fmt"
  "math"
)

func main() {
  const N = 1000000
  var temp [N+1]bool
  for i:=0; i<N+1; i++ {
    temp[i] = true
  }
  temp[0] = false
  temp[1] = false
  for i:=2; i<int(math.Ceil(math.Sqrt(float64(N+1)))); i++{
    if (temp[i]){
      for j:=i*2; j<N+1; j+=i{
        temp[j] =false
      }
    }
  }
  var a int
  var b int
  for _, err := fmt.Scan(&a); err == nil; _, err = fmt.Scan(&a) {
    b = 0
    for i:=0; i<=a; i++{
      if temp[i] {
        b++
      }
    }
    fmt.Println(b)
  }
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  vector<int> elat(1000010, 1);
  elat[0] = elat[1] = 0;
  for (int i = 2; i <= 1000000; i++) {
    if (!elat[i]) continue;
    for (int j = i * 2; j <= 1000000; j += i) {
      elat[j] = 0;
    }
  }
  rep(i, 1000000) elat[i + 1] += elat[i];

  int n;
  while (cin >> n) {
    cout << elat[n] << '\n';
  }
}

C++: #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define N 999999
bool num[N];

void furui(){
  long int i;
  int divide;
  int rt = (int) sqrt(N);
  for(i = 0L; i < N; i++){
    num[i] = true;
  }
  num[0] = false;
  num[1] = false;
  for(divide = 2; divide <= rt; divide++){
    if(num[divide] == false) continue;
    for( i = divide; i < N; i+= divide){
      num[i] = false;
    }
    num[divide] = true;
  }
}

int main(){
  int c, i, j;
  long int k;
  char buf[7];
  long int n;
  long int count;

  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);
    count = 0L;
    for(k = 1L; k <= n; k++){
      if(num[k] == 1) count++;
    }
    printf("%ld\n", count);
    if(c == EOF) break;
  }
  return 0;
}

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

using namespace std;

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

C++: #include <stdio.h>

int main(){
	int sosuu[] = { 2, 3, 5 }, i, x, y = 3,n=0,z;
	
	while (scanf("%d", &n)!=EOF){
		z = 0; 
		for (i = 3; i < n + 1; i += 2){
			for (x = 0; x < y; x++){
				if (i % sosuu[x] == 0){ break; }
				if (x + 1 == y){ sosuu[y] = i, y++;}
			}
		}
		for (i = 0; i < y; i++){ if (sosuu[i] > n)break; z++; }
		printf("%d\n", z);
	}
	return 0;
}

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

int prime(int a){

int i,p;

	
	if(a == 2) return 1;
	if(a % 2 == 0) return 0;
		p = sqrt(a);
	for(i=3;i<=p;i+=2){
		if(a%i == 0) return 0;
	}
return 1;
}

int main(void){
	
	int a,i,count=0;
	
	while(scanf("%d",&a) != EOF){;
	
	for(i=2;i<=a;i++){
		
		count += prime(i);
	}
	
	printf("%d\n",count);
}

return 0;
}

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

using namespace std;

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

int main(){
	int n, i, count;
	while(cin >> n){
		count = 0;
		for(i = 2; i <= n; i++){
			if(i == 2 || i == 3) count++;
			else if(isprime(i) == 1 && i % 2 != 0) count++;
		}
		cout << count << endl;
	}
	return 0;
}

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

int sosu(int num){
	int i,j;
	int flag=0;
	int ans=1;
	
	for(i=3;i<=num;i+=2){
		for(j=3;j<=sqrt(num);j+=2){
			if(i==j)j++;
			if(i%j==0){
				flag=1;
				break;
			}
		}
	if(flag==0)ans++;
	flag=0;
	}
	return ans;
}

int main(){
	int num;
	int ans=0;
	int i,j,k;
	int box[1000000];
		
	while(scanf("%d",&num)!=EOF){
		
		for(i=2;i<=num;i++)box[i]=1;
		
		for(i=2;i<=sqrt(num);i++){
			if(box[i]==1){
				for(j=2;i*j<=num;j++){
					box[i*j]=0;
				}
			}
		}
		for(i=0;i<=num;i++)if(box[i]==1)ans++;
		printf("%d\n",ans);
		ans=0;
	}
	return 0;
}

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

bool IsPrime(int m){
    if(m==1){
        return(0);
    }else if(m==2){
        return(1);
    }else if(m%2==0){
        return(0);
    }else{
        for(int i=3;i*i<=m;i+=2){
            if(m%i==0)return(0);
        }
        return(1);
    }
}

int main(){
    int n;
    int r[30];
    for(int i=0;i<30;i++){
        r[i]=0;
    }
    int j=0;
    while(cin>>n){
        for(int i=1;i<=n;i++){
            if(IsPrime(i))r[j]++;
        }
        cout<<r[j]<<endl;
        j++;
    }
    return(0);
}

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

using namespace std;

int main(){
        int i=2,j=2,n,count=0;
        while(scanf("%d",&n) != EOF){
                while(i <= n){
                        while(j <= i){
                                if(i%j == 0) break;
                                j++;
                        }
                        if(j == i){
                                count++;
                        }
                        i++;
                        j = 2;
                }
                i = 2;
                cout << count <<endl;
                count = 0;
        }
        return 0;
}