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

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <math.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std; 
int main(){
	int N;
	while(cin >> N)
	double p = std::log2(N);
	while (cin >> N){
		int sum =0;
		cout << N*p << endl;
	}
	return 0;
}

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

int main(){
	int n,s,a;
	
	while(cin >> n){
		a=0;
		for(int j=2;j<=n;j++){
			s=0;
			for(int i=2;i<j;i++){
				if(j%i==0){
					s++;
				}
			}
			if(s==0){
				a++;
			}
		}
		cout << a << "\n";
	}
		
	
return 0;
}

C++: #include<iostream>
#include<cstdio>
int cnt,n,prime[1000000];
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;
	}
}

int main()
{	getprime();
	while(true)
	{
	   scanf("%d",&n);
	   if(n==1){
	   	printf("%d\n",0);
	   	continue;
	   }
       for(int i=0;i<1000000;i++){
       	if(prime[i]>n){
       		printf("%d\n",i);
       		break; 
		   }
	   }
    }
}

C++: #include <cstdio>

typedef long long LL;

int p[100010];
bool np[1000010];
int cntp;

void SievePrime(int n) {
  LL t;
  for(int i = 2; i <= n; ++i) {
    if(!np[i]) p[cntp++] = i;
    for(int j = 0; j < cntp && (t = 1ll * i * p[j]) <= n; ++j) {
      np[t] = true;
      if(i % p[j] == 0) break;
    }
  }
}

int main() {
  SievePrime(1000000);
  int n;
  while(scanf("%d", &n) != EOF) {
    int ans = 0;
    for(int i = 2; i <= n; ++i) {
      if(!np[i]) ++ans;
    }
    printf("%d\n", ans);
  }
  return 0;
}

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

int main(void)
{
    int n, cnt;
    while (cin >> n) {
        cnt = 0;
        for (int i = 1; i <= n; ++i)
            if (n%i == 0)
                ++cnt;
        cout << cnt << endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)



const int PS = 1000000;
int prime[PS];
int set_prime(){
	rep(i,PS)prime[i]=1;
	prime[0]=prime[1]=0;
	rep(i,PS){
		if(prime[i]==0)continue;
		for(int j=i*2;j<PS;j+=i)prime[j]=0;
	}
}


int sum[PS];
int set_sum(){
	set_prime();
	rep(i,PS)sum[i]=0;
	reps(i,1,PS)sum[i]=sum[i-1]+prime[i];
}
int main(){
	set_sum();
	
	int a;
	while(scanf("%d",&a)!=EOF){
		printf("%d\n",sum[a]);
	}
}

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

int main(){
  bool prime[1000000];
  int np[1000000], n;

  for(int i=2; i<1000000; i++){
    if(!prime[i]){
      for(int j=2; j*i<1000000; j++){
	prime[i*j] = true;
      }
    }
    np[i] = np[i-1] + !prime[i];
  }

  while(cin >> n)
    cout << np[n] << endl;

  return 0;
}

C++: #include<iostream>

int a,n[40],c[40];
int main (){
	for(int i=2;i<31;i++){
		n[i]=1;
		for(int j=2;j<i;j++){
		if(i%j==0){
			n[i]=0;
			j=i;
		}
		}
	}

	for(int i=1;i<31;i++){
		c[i]=c[i-1]+n[i];
	}
	while(scanf("%d"a)^){
		printf("%d",c[a]);
	}
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int isprime(int x){
    if(x==2) return true;
    if(x<2||x%2==0) return false;
    else{
        int i=3;
        while(i<=sqrt(x)){
            if(x%i==0) return false;
            i = i+2;
        }
        return true;
    }
}
int main() {
    int n;
    while(cin >> n){
        int ans=0;
    for (int j=0; j<=n; j++) {
        if(isprime(j)!=0) ans++;
    }
    cout << ans << endl;
    }
}

C++: #include <cstdio>
int NUM = 1000000;
bool prime[NUM];
int main(){
  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;scanf("%d",&n)+1;printf("%d",primeNum[n]));
}

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

using namespace std;

int prime(int n) {
  int i, j, r;
  n++;
  vector<int> primes(n);

  for (i = 2; i < n; ++i)
    primes[i] = i;
  for (i = 2; i*i < n; ++i) {
    if (primes[i])
      for (j = i*i; j < n; j += i)
        primes[j] = 0;
  }
  for (i = r = 0; i < n; i++)
    if (primes[i]) r++;

  for (i = r; i < n; i++)
    cout << primes[i] << " ";
  cout << endl;
  return r;
}

int main() {
  int n;
  while(cin >> n)
    cout << prime(n) << endl;
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
bool isprime(int& num)
{
    static int c;
    if(num == 2) return true;
    for(c=2; c <= sqrt(num); c+=1)
        if(num % c ==0) return false;
    return true;
}

int main()
{
    int ans = 0;
    int buff;
    while(cin >> buff);
    {
        for(int d =2; d <= buff; d++)
        {
            if(isprime(d)) ans++;
        }
        cout << ans << " ";
        ans  = 0;
    }
    cout << endl;
    return 0;
}

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

int main(){
	int n;
	 
	bool prim[1000001];
	for(int i=0;i<1000001;i++) prim[i] = true;
	prim[1]=false;
	for(int i=3;i<1000001;i++){
		if(i%2==0) prim[i] = false;
		else if(prim[i]){
			for(int j=i*2;j<=1000001;j+=i) prim[j] = false;
		}
	}
	

	while(cin >> n){
		int ans=0;
		for(int i=1;i<=n;i++){
			if(prim[i]) ans++;
		}
		cout << ans << endl;
	}
}

C++: #include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int a[1000100];
int jud(int n){
	int i;
	for (i=2;i<=sqrt(n);i++){
		if (n%i==0)
		return 0;
	}
	return 1;
}
int main(){
	int n;
	while (cin>>n){
		int i,j,res=0;
		memset(a,0,1000000*sizeof(int));
		for (i=2;i<=n;i++)
		if (!a[i]){
			if (jud[i]){
			res++;
			if (i<1000){
			for (j=i*i;j<1000000;j+=i){
				a[j]=1;
			}
			}
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

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

int main()
{
	int n = 0, x = 0;
	int countdata[1000];
	while (cin >> n) {
		if (n / 1000000 > 0) {
			int count = 0;
			for (int a = 2; a <= n; a++) {
				if (a % 2 != 0 && a % 3 != 0 && a % 5 != 0 && a % 7 != 0 || a == 2 || a == 3 || a == 5 || a == 7) {
					count++;
				}
			}
			countdata[x] = count;
			x++;
		}
	}
	for (int a = 0; a < x; a++) {
		cout << countdata[a] << endl;
	}
}

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

int main(){
 int i,j,n,count,flg;
 scanf("%d",&n);
 for(i=2,count=0;i<=n;i++){
  for(j=2,flg=1;j<=i/2;j++)
   if(i%j==0){ printf("%d\n",i); flg=0; break; }
  count+=flg;
 }
 printf("%d\n",count);
 return 0;
}