Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var resultArr [40]int
	var inputCount, primeCount, input int
	for {
		fmt.Scanf("%d", &input)
		for i := 0; i <= input; i++ {
			if IsPrime(i) {
				primeCount++
			}
		}
		resultArr[inputCount] = primeCount
		if inputCount == 30 {
			break
		}
		primeCount = 0
		inputCount++
	}
	for _, v := range resultArr {
		fmt.Printf("%d\n", v)
	}
}

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
}

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

//2,3,5????????°????¨?????????????????????????????¨??????????????????¨??????


int main(void){

	int n,count_num,count_pnum;

	while (cin >> n){
		count_num = 0;
		for (int i = 2; i < n+1; i++){
		
			//2,3,5?????¨????????????
			if (i == 2 || i == 3 || i == 5){ count_num++; }

			if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0){
			//2,3,5??§?????????????????¨???????´???°??§??????????????§?¨?????????????
				count_pnum = 0;
				for (int j = 7; j < i; j++){
					if (i%j != 0)count_pnum++;
				}if (count_pnum == i - 7)count_num++;


			}
		}cout << count_num << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <list>
#include <algorithm>

using namespace std;

int main() {
  int n;
  
  while(!cin.eof()) {
    cin >> n;
    list<int> search_list(n);
    list<int> prime_number;
    while(n!=1) {
      search_list.push_front(n);
      n--;
    }
    while(!search_list.empty()) {
      int m = search_list.front();
      prime_number.push_back(m);
      search_list.pop_front();
      list<int>::iterator it = search_list.begin();
      while(it!=search_list.end()) {
	if((*it % prime_number.front()) == 0){
	  it = search_list.erase(it);
	  continue;
	}
	it++;
      }				   
    }
    cout << prime_number.size()-1 << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(int argc,char* argv[]){
unsigned x[30];
int count=0;
for(int i=0;i<argc;I++){
cin>>x[i];
}
for(int i=0;i<argc(i++){
for(int j=1;j<x[i];j++){
if(x[i]%j!=0)
count++;
}
cout<<count<<endl;
count=0;
}
return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
        int n;
        int d; //素数を入れるための添字
        bool count; //割りきれるかどうかの判定
        int number[400000]; //素数を入れておく
        number[0] = 2;
        
        
        while(cin >>n != 0){
                d = 0;
                for(int i = 3; i <= n; i++){
                        count = true;
                        for(int j = 0; j <= d; j++){
                                if(i % number[j] == 0){
                                        count = false;
                                }
                        }
                        if(count == true){
                                d++;
                                number[d] = i;
                        }
                }
        cout << d+1 << endl;
        }
}

C++: #include<stdio.h>
int main(){
	int a,b,c,n;
	c=0;
	scanf("%d",&n);
	for(a=1;a<=n;a++){
		for(b=2;b<=n;b++){
			if(a%b==0&&a!=b){
				break;
			}else if(a%b==0&&a==b){
				c++;
			}else{
			}
		}
	}
	printf("%d\n",c);
	return 0;
}

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

// bool isPrime(unsigned int n);

int main()
{
    int n;
    while(cin>>n){
        vector<int> primeTable;
        if( n==1 ){ cout << "0" << endl; continue; }
        primeTable.push_back(2);
        for(int i=3; i<=n; i++){
            vector<int>::iterator j;
            for(j=primeTable.begin(); j!=primeTable.end(); j++){
                if(!(i%(*j))) break; // i%j!=0
            }
            if( j==primeTable.end() ) primeTable.push_back(i);
        }
        cout << primeTable.size() << endl;
    }
    

    return 0;
}

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

#define rep(i, n) for(int i = 2; i <= n; i ++)

using namespace std;

int main(void){
	for(int n, count = 0; cin >> n; cout << count << endl, count = 0){
		vector<bool> numberList(n + 1);

		rep(i, n) numberList[i] = true;

		for(int i = 2; i * i <= n; i ++) for(int j = i; i * j <= n; j ++) if(numberList[i * j]) numberList[i * j] = false; 
		
		rep(i, n) if(numberList[i]) count ++;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
int main()
{
    long long int low, high, i, flag,c, s ;
    while(scanf("%lld",  &high)!=EOF){
    long long int start = 2;

    c = 0;


    while (start <= high)
    {
        flag = 0;
        s = sqrt(start);
        for(i = 2; i <= s; i++)
        {
            if(start% i == 0)
            {
                flag = 1;
                break;
            }
        }

        if (flag == 0)
        {
              c++;
        }
        start++;

    }
    printf("%lld\n",c);

    }

C++: #include <iostream>
#include <algorithm>
using namespace std;
vector<int> prime;
void init(){
	for(int i=2;i<999999;i++){
		bool isprime=true;
		for(vector::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>
#include<cmath>
#include<vector>
using namespace std;

int main() {
	int n, cnt; 
	while (cin >> n) {
		cnt = 0;
		vector<bool> v(n + 1, true);
		for (int i = 2; i*i <= n; i++) {
			if (v[i]) {
				for (int j = 2 * i; j <= n; j += i) {
					v[j] = false;
				}
			}
		}
			for (int i = 2; i <= n; i++) {
				if (v[i]) cnt++;
			}
		cout << cnt << endl;
	}
	return 0;
}

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

int IsPrime(int n){
    int i;

    for(i = 3; i * i <= n; i += 2)
         if(n % i == 0)
            return 0;
    return 1;
}

int main()
{
	int in;
	
	while(scanf("%d",&in) != EOF){
		int c = 0;

		for(int i=3;i<in;i+=2)
			if(IsPrime(i) == 1)
				++c;

		if(in >= 2)	++c;
		
		cout << c << endl;
	}

	return 0;
}

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

//using namespace std;

int sosuu(int n);

int main(){
    int n = 0;
    
    while(scanf("%d",&n)!=EOF){
        int temp = 0;
        if(n==1){
            printf("%d\n",0);
        }else{
            for(int i=2; i<=n; i++ ){
                temp+=sosuu(i);
                if(i!=2){
                    i++;
                }
            }
            printf("%d\n",temp);
        }
    }
}

int sosuu(int n){
    for(int i=2; i<sqrt(n); i++){
        if(n%i == 0){
            return 0;
        }
        if(i!=2){
            i++;
        }
    }
    return 1;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define ll (long lon
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main (void){
    
    int number[40] = {0};
    int answer[40] = {0};
    int i = 0,j = 0,k = 0;
    while(cin >> number[i])
    {
        for(k = number[i]; k>1;k--)
            for(int l = k-1;l>0;l--)
            {
                if(k == 2 && l == 1)
                {
                    answer[i]++;
                    break;
                }
                if(k % l == 0)
                    break;
                if(l == 2)
                {
                    answer[i]++;
                }

            }
        i++;
    }
    REP(j,i)
    cout << answer[j]<< endl;
    return 0;
    
}