Go: package main

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

func search(min, max int, channel chan int) {
	flag := false
	count := 0
	for i := min; i <= max; i++ { //1を除く入力値以下の数字
		for j := 2; j < i; j++ {
			if i%j == 0 {
				flag = true
				break
			}
		}
		if !flag {
			count++
		} else {
			flag = false
		}
	}
	channel <- count
	return
}

func main() {
	count := 0
	channel := make(chan int)
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		num, _ := strconv.Atoi(scanner.Text())
		for i := 2; i < num; i += 10 {
			if i+10 < num {
				count++
				go search(i, i+10, channel)
			} else {
				count++
				go search(i, num, channel)
			}
		}
		var ans int
		for i := 0; i < count; i++ {
			ans += <-channel
		}

		fmt.Println(ans)
	}
}

Python: # coding: utf-8

import sys
import math

max = 11
prime = [2,3,5,7,11]

for line in sys.stdin:
    
    n = int(line)
    
    if n > max:
        for m in range(max + 1, n + 1):
            flag = 1
            
            if m % 2 == 0:
                flag = 0
            else:
                for p in prime:
                    if p > math.sqrt(m):
                        break
                    if m % p == 0:
                        flag = 0
                        break
            
            if flag == 1:
                prime.append(m)
        
        max = n
    
    count = 0
    for i in prime:
        if i > n:
            break
        count += 1
        
    print(count)

Python: plst = [1 for i in range(1000001)]
plst[0] = plst[1] = 0
for i in range(2,1000001):
  if plst[i] == 1:
    for j in range(i * 2,1000001,i):
      plst[j] = 0
while True:
  try:
    print(sum(plst[:int(input()) + 1]))
  except EOFError:
    break

Python: import sys
a=[0,0,1]+[1,0]*5*10**5
for i in range(4,999):
 if a[i]:a[i*2::i]=[0]*len(a[i*2::i])
for e in sys.stdin:print(sum(a[:int(e)+1]))

Python: import sys
m=10**6;a=[0,0]+[1]*m
for i in range(2,999):
 if a[i]>0:
  for j in range(i*2,m,i):a[j]=0
for e in sys.stdin:print(sum(a[:int(e)+1]))

Python: import math

def prime_judge(n):
    if n==1:
        return False
    elif n==2:
        return True
    elif n%2==0:
        return False
    else:
        sqrt_num=math.ceil(math.sqrt(n))+1
        for i in range(3,sqrt_num, 2):
            if n%i==0:
                return False
        return True

def prime_count(n):
    count=0
    for i in range(1,n+1):
        if prime_judge(i):
            count+=1
    print(count)

while 1:
    try:
        prime_count(int(input()))        
    except:
        break

Python: # coding: utf-8

import math

def sieve_of_erastosthenes(input_list):

    for num in input_list:
        if 2 > num:
            return 0

        serial_number_list = [r for r in range(2, num + 1)]
        multiple_list = []
                
        while math.sqrt(num) >= serial_number_list[0]:
            i = 1

            serial_number = serial_number_list[0]
      
            multiple_list.append(serial_number)
                        
            while serial_number_list[len(serial_number_list) - 1] >= serial_number * i:
        
                if serial_number * i in serial_number_list:
                    
                    serial_number_list.pop(serial_number_list.index(serial_number * i))

                i += 1

        print(len(multiple_list + serial_number_list))

if __name__ == '__main__':
    input_list = []

    while True:
        try:
            input_list.append(int(input()))
        except:
            break

    sieve_of_erastosthenes(input_list)

Python: numlist=[0,0,1]+[0]*999998
for i in range(3,1000000,2):
    numlist[i]=1
for i in range(3,1000,2):
    if numlist[i]==1:
        for j in range(i*i,1000000,i):
            numlist[j]=0

cnt=[0,0,1]+[0]*999999
count=1
for i in range(3,1000000,2):
    if numlist[i]:
        count+=1
    cnt[i]=cnt[i+1]=count
while True:
    try:
        n=int(input())
        print(cnt[n])
    except:
        break

Python: import math

num_max = 999999
i = 3
prime_list = [2]
while i<num_max :
	judge = True
	j = 0
	while prime_list[j] <= math.sqrt(i) :
		if (i%prime_list[j]==0) :
			judge = False
			break
		j += 1
	if(judge) :
		prime_list.append(i)
	i += 2
while True :
    try:
        n = input()
        k = 0
        while prime_list[k] <=  n :
            k += 1
        print(k)
    except EOFError :
        break

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import math

N = 1000000

TABLE = [True] * N

def sieve():
    TABLE[1] = False

    sqrtn = int(math.sqrt(N))

    for i in range(2, sqrtn+1):
        if TABLE[i]:
            for j in range(2*i, N, i):
                TABLE[j] = False

    """
    for i in range(4, N, 2):
        TABLE[i] = False

    for i in range(6, N, 3):
        TABLE[i] = False

    for i in range(6, N, 6):
        p1 = 6*i - 1
        p2 = 6*i + 1

        if p1 >= N: break

        if TABLE[p1]:
            for j in range(2*p1, N, p1):
                TABLE[j] = False

        if p2 >= N: break

        if TABLE[p2]:
            for j in range(2*p2, N, p2):
                TABLE[j] = False
    """

def main():
    sieve()

    for line in sys.stdin:
        n = int(line)

        cnt = sum(map(lambda k: TABLE[k], range(1, n+1)))
        print(cnt)

if __name__ == "__main__": main()

Python: from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n) + 1
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c, floor(n/c) + 1, 1):
            l[c * k -1] = 0
        c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Python: # -*- coding: utf-8 -*-

while True:
    try:
        n = int(raw_input())
        list1 = range(2, n)
        list2 = []
        while True:
            i = list1.pop(0)
            list2.append(i)
            for x in list1:
                if x % i == 0:
                    list1.remove(x)
            if i**2 > list1[::-1][0]:
                break

        print(len(list2 + list1))
    except EOFError:
        break

Python: from math import sqrt
I_list=[]
#input syutoku
while True:
	try:
		k=int(input())
		I_list.append(k)
	except:
		break

I_max=max(I_list)
#create list (I_max=100 -> [3,5,7,...,99])
odd_list=[x for x in range(3,I_max+1,2)]
#print(W_list)

P_list=[2]

p=0
#print(I_list)
ct=0
while p<=int(sqrt(I_max)):
	p=odd_list.pop(0)
	P_list.append(p)
	P_baisuu=[p*x for x in range(1, int(I_max/p) +1 )]
	K_list=set(odd_list)-set(P_baisuu)
	odd_list=sorted(list(K_list))
#	print("P_list=")
#	print(P_list)
#	print("odd_list=")
#	print(odd_list)

prime_list=P_list+odd_list
#print("prime_list=")
#print(prime_list)

for i in I_list:
	w=[j for j in prime_list if j<=i ]
	print(len(w))

Python: # coding: utf-8

import sys
import math


if __name__ == '__main__':
	input_list = sys.stdin.readlines()

	for num in input_list:
		target_number = int(num.replace('\n', ''))
		serial_number_list = [r for r in range(2, target_number + 1)]
		multiple_list = []

		while math.sqrt(target_number) >= serial_number_list[0]:
			serial_number = serial_number_list[0]
			i = 1
			multiple_list.append(serial_number)

			while target_number >= serial_number * i:
				
				if serial_number * i in serial_number_list:
					serial_number_list.pop(serial_number_list.index(serial_number * i))

				i += 1

		print(multiple_list)

Python: from math import sqrt
def eratosthenes(n):
  def era(x,p):
    if x<=p or (x>p and x%p!=0):
      return x
    else:
      return None
  A=[i for i in range(2,n+1)]
  p=2
  while p<=sqrt(n):
    A=list(filter(lambda x:era(x,p),A))
    p+=1
  return(A)
print(eratosthenes(int(input())))