Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		flag := false
		count := 0

		for i := 3; i <= num; i += 2 { //1を除く入力値以下の数字
			for j := 3; j < i; j += 2 {
				if i%j == 0 {
					flag = true
					//fmt.Println(i, "/", j)
					break
				}
			}
			if !flag {
				count++
			} else {
				flag = false
			}
		}
		fmt.Println(count + 1)
	}
}

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

bool check(int in){
	for (int i = 3; i<=sqrt(in); i+=2){
		if (i != 5 && i % 5 == 0)	continue;
		if (in % i == 0)
			return false;
	}
	return true;
}

int PrimeNumber(int in, int start){
	int count = 0;
	if (in > 2)	count++;
	for (int i = start; i <=in; i+=2){
		if (check(i))	count++;
	}

	return count;
}

int main(){
	int in;
	int count250000 = PrimeNumber(250000, 3);
	int count500000 = count250000 + PrimeNumber(500000, 250001) -1;
	int count750000 = count500000 + PrimeNumber(750000, 500001) -1;

	while (cin >> in, !cin.eof()){
		if (in <= 250000)
			cout << PrimeNumber(in, 3) << endl;
		else if (in <= 500000)
			cout << count250000 + PrimeNumber(in, 250001)-1 << endl;
		else if (in <= 750000)
			cout << count500000 + PrimeNumber(in, 500001)-1 << endl;
		else
			cout << count750000 + PrimeNumber(in, 750001)-1 << endl;
	}
}

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

int main(){
	int n,w=0;
	cin >> n;
	for(int j=n;j>1;j--){
		for(int i=2;i<j;++i){
			if(j%i == 0){
				cout << j << "ツづュツづゥ" << i << "=" <<"NA" <<endl;
				break;
			}else{
				cout << j << "ツづュツづゥ" << i << "=" <<"OK" << endl;
			}
			if(i=j-1){
				w++;
			}
		}
	}
	cout << w;	
	return 0;
}

C++: #include<stdio.h>
#define N 1000000

int main() {
	int ipt;
	int root;
	int cnt = 0;
	int A[N];
	for (int i = 1; i <= N; i++) {
		A[i] = i;
	}
	for (int pos = 2; pos*pos <= N; pos++) {
		root = A[pos];
		if (!root)continue;
		for (int k = 2; k*root <= N; k++) {
			A[k*root] = 0;
		}
	}

	while(1) {
		scanf("%d", &ipt);
		for (int i = 2; i <= ipt; i++) {
			if (A[i] != 0)cnt++;
		}
		printf("%d\n", cnt);
		cnt = 0;
	}

	return 0;
}

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

int main(void){
	int n;
	
	int i,j;
	int count = 0;
	int Flag = 0;
	
	while(scanf("%d",&n) != EOF){
		for(j = 1;j <= n;j += 2){
			for(i = 1;pow(i,2) <= j;i++){
				if(j % i == 0&&i != 1){
					Flag = 1;
					break;
				}
			}
			if(Flag != 1){
				count++;
			}
			Flag = 0;
		}
		printf("%d\n",count);
		count = 0;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

vector<int> primes;
bool is_prime[1000100];

void search_prime(int n){
	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]){
			primes.push_back(i);
			for(int j = i * 2; j <= n; j += i)
				is_prime[j] = false;
		}
	}
}

int main() {
	search_prime(1000050);
	int n;
	while(cin >> n){
		if(n == 0 && n == 1){
			cout << "0" << endl;
		}
		else{
			int idx = lower_bound(primes.begin(), primes.end(), n) - primes.begin();
			if(primes[idx] == n)
				idx++;
			cout << idx << endl;
		}
	}
	return 0;
}

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

#define Max 1000000

int prime [10000000];

int main()
{
	int n, out;
	for (int i = 2; i * i < Max; i++){
		if (prime[i] == 0){
			for (int j = i; j < Max; j += i){
				if (!(j == i)) prime[j] = 1;
			}
		}
	}
	while (cin >> n){
		out = 0;
		for (int i = 0; i <= n; i++){
			if (prime[i] == 0) out++;
		}
		cout << out - 2 << endl;
	}
	return(0);
}

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

int main() {
	bool isPrime[1000000] = {true};

	for (int i = 0; i < 1000000; i++) {
		isPrime[i] = true;
	}

	isPrime[1] = false;
	for (int i = 2; i < 1000000; i++) {
		if (!isPrime[i])
			continue;

		if (isPrime[i]) {
			int k = 2*i;
			while (k < 1000000) {
				isPrime[k] = false;
				k += i;
			}
		}
	}

	int n;
	while (cin >> n) {
		int sum = 0;
		for (int i = 2; i <= n; i++) {
			if (isPrime[i])
				sum++;
		}
		cout << sum << endl;
	}

	return 0;
}

C++: #include<stdio.h>

int main(){
    int i,j,n;
    int stack[30],sp=0;
    while(scanf("%d",&stack[sp++])!=EOF);
    for(i=0;i<sp-1;i++){
        n=0;
        for(j=2;j<stack[i];j++)
            if(stack[i]%j==0)n++;
        printf("%d\n",n);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int NUM = 1000000;
  bool prime[NUM];
  prime[0] = false;prime[1] = false;
  for(int i=2;i<NUM;i++)prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;

	int primeNum[NUM];
	for(int i=0,c=0;i<NUM;i++){
		prime[i]||c++;
		primeNum[i] = c;
	}
	for(int n;cin>>n;cout<<primeNum[n]<<endl);
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

bool isp[1000000]={};


void makeEra(){
    for(int i=2;i<=1000;i++){
        if( isp[i] ){
            for(int j=2;j<=1000000/i;j++){
                isp[i*j]=false;
            }
        }
    }
}


int main(){
    rep(i,1000000)isp[i]=true;
    isp[0]=isp[1]=false;
    makeEra();
    
    int n;
    while(cin>>n){
        int c = 0;
        rep(i,n+1){
            if(isp[i])c++;
        }
        cout<<c<<endl;
    }
}

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

bool sosuu[1000000];

int main(void)
{
	int n;
	int sq;
	int i,j;
	int count;
	bool flag;
	int m;

	for(i=2;i<=1000;i++)
	{
		for(j=2;j<=int(1000000/i);j++)
			sosuu[i*j]=true;
	}

	while(~scanf("%d",&n))
	{

		count=0;
		for(m=2;m<=n;m++)
		{
			if(sosuu[m] == false)
				count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a;
	int count;
	int ccount;
	vector<int> c = { 0 };
	while (cin >> a)
	{
		a = a + 1;
		count = 0;
		/*
		// ?´???°?????????
		// ??????????????°
		for (size_t i = 2; i < a; i++)
		{
			ccount = 0;
			// ????????°
			for (size_t j = 1; j <= i; j++)
			{
				//cout << "i= " << i << "j= " << j << endl;
				if (i % j == 0) {
					ccount++;
				}
			}
			if (ccount > 2) {
				count++;
			}
		}*/
		// ?????§????????§????????????0??§???????????????
		c.resize(a);

		
		// 2*i????????§????????§?????????????????????1?????????
		for (size_t i = 2; i < a; i++)
		{
			for (size_t j = 2; i*j < a; j++)
			{
				//cout << i*j << endl;
				c[i*j] = 1;
			}
		}
		// ??????????????????0??????????????°????????????
		for (size_t i = 0; i < a; i++)
		{
			if (c[i] == 0) {
				count++;
			}
		}
		cout << count-2 << endl;

		// ?¢??????¨
		/*
		for (size_t i = 0; i < a; i++)
		{
			cout << i << " = " << c[i] << endl;
		}
		*/
		
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;



int main(){

  int n;

  bool p[999999];
  int head;
  int sum;

  while(scanf("%d",&n)!=EOF){

    head = 2;
    sum = 0;

    for(int i=0; i<n; i++){ p[i]=false; }

    while(head<=n){
      
      while(head<=n && p[head-1]==true){ head++; }

      if(!(head>n))sum++;

      for(int i=2; i*head<=n; i++){p[i*head-1]=true;}

      head++;
    }

    cout << sum << endl;
      

  }


  return 0;
}