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: def e(n):
    array = [1]*(n+1)
        
    k = 2
    
    while k*k <= n:
        if array[k] == 1:
            i = k
    
            while (i <= n/k):
                array[k*i] = 0
                i += 1
        
        k += 1
    
    # ?´???°(array[i]==1)?????????
    prime = []
    i = 2
    
    while i <= n:
        if array[i] == 1:
            prime.append(i)
        i += 1
    
    return len(prime)


while True:
    try:
        n = int(input())
        print(e(n))
        
    except:
        break

Python: import sys
def prime(n):
    for i in range(2, n):
        if n < i ** 2: break
        elif n % i == 0: return False
    return True

[print(len([i for i in range(2, int(x)) if prime(i)])) for x in sys.stdin]

Python: from sys import stdin

for Input in stdin :
    Input = int(Input)
    if (Input <= 10) : 
        if   (Input <= 1) : print(0)
        elif (Input == 2) : print(1)
        elif (Input == 3) or (Input == 4) : print(2)
        elif (Input == 5) or (Input == 6) : print(3)
        else : print(4)
    else :
        result = 4
        for make in range(11, Input + 1, 2) :
            if (make % 2 != 0) and (make % 3 != 0) and (make % 5 != 0) and (make % 7 != 0) : result += 1
        print(result)

Python: import math
def check_prime(goal):
    true_or_false=False
    for i in range(2,goal):
        if goal%i==0:
             true_or_false=True
    if true_or_false==False:
        return True
    else:
        return False
anss=[]
while True:
    try:
        num=int(input())
        num_of_prime=0
        for i in range(2,num+1):
           if check_prime(math.sqrt(i)):
               num_of_prime+=1
        anss.append(num_of_prime)
    except:
        break
for ans in anss:
    print(ans)

Python: import sys

ary=[]
for i in sys.stdin:
    ary.append(int(i))
m = max(ary)
prime=[1] * (m + 1)
prime[0] = prime[1] = 0
for i in range(2, int(m ** 0.5) + 1):
    if prime[i] == 1:
        for j in range(i*2, m + 1, i):
            prime[j] = 0
for i in range(len(ary)):
    print(sum(prime[:ary[i]]))

Python: import math
import sys

def prime_calc(n):
    rootN = math.floor(math.sqrt(n))
    prime = [2]
    data = [i + 1 for i in range(2,n,2)]
    while True:
        p = data[0]
        if rootN < p:
            return len(prime + data)
        prime.append(p)
        data = [e for e in data if e % p != 0]

def main():
    l = []

    for line in sys.stdin:
        l.append(line)        

    for line in l:
        print(prime_calc(line))

if __name__ == "__main__":
    main()

Python: import sys
m=166666;s=[1]*m;t=[1]*m
for i in range(m):
 if s[i]:
  k=6*i+5
  s[i+k::k]=[0]*len(s[i+k::k])
  t[-2-i+k::k]=[0]*len(t[-2-i+k::k])
 if t[i]:
  k=6*i+7
  s[-2-i+k::k]=[0]*len(s[-2-i+k::k])
  t[i+k::k]=[0]*len(t[i+k::k])
for e in sys.stdin:
 e=int(e)
 print([e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])+2][e>3])

Python: import sys
prime = [0 for i in range(1000000)]
isPrime = [1 for i in range(1000000)]
isPrime[0] = 0
isPrime[1] = 0
p = 0

for i in sys.stdin:
    n = int(i)
    for i in range(2,n+1):
        if isPrime[i] == 1:
            p += 1
            prime[p] = i
            for j in range(i*2, n+1, i):
                isPrime[j] = 0
    print(sum(isPrime[:n+1]))

Python: import sys,random

rand = random.randint

def prime(n):
	if n == 2: return True
	if n < 2 or n & 1 == 0: return False
	return pow(2, n-1, n) == 1

a = [prime(i) for i in range(1000000)]

for s in sys.stdin:
	i = int(s)
	print(a[:i+1].count(True))

Python: import sys
a=[1]*500000
for i in range(3,999,2):
 x=i*i
 if a[i//2]:a[x//2::i]=[0]*len(a[x//2::i])
for e in map(int,sys.stdin):print([e-1,sum(a[:(e+1)//2])][e>4])

Python: # coding: utf-8
# Here your code !
import sys
import math

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1????´???°??§?????????

    # ??¨??????????????????????????????
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
    
prime_list = primes(1000000)

for line in sys.stdin:
    n = int(line)
    count = 0
    for p in prime_list:
        if p > n:
            break
        count += 1
    print(count)

Python: def erato(n):
    s = list(range(n+1))
    s[1] = 0
    for e in s:
        if e:
            for i in range(e*2, n+1, e):
                s[i] = 0
    return s
e = erato(1000000)
while True:
    try:
        n = int(input())
        print(len(list(filter(lambda x:x, e[:n+1]))))
    except:
        break

Python: def sieve(n):
    p = [True for i in range(n + 1)]
    p[0] = p[1] = False
    end = int(n ** .5)
    for i in range(2, end + 1):
        if p[i]:
            for j in range(i * i, n + 1, i):
                p[j] = False

    return p

def primes_below(n):
    c = 1
    for i in range(3, n + 1, 2):
        if p[i]: c += 1

    return c

p = sieve(1000000)
while 1:
    try:
        n = int(input())
    except EOFError:
        break
    else:
        print(primes_below(n))

Python: t = 0
while t == 0:	
	prime = [2,3]
	try:
		n = int(input())
	except:
		break
	#?¨??????\???????????????????¨????
	else:
		if n == 1:
		#1?????????
			print(0)
		elif n == 2:
			print(1)
		else:
			a = 5
			while a < n:
			#5??\????????????
				total = len(prime)
				#?´???°?????°?????????
				for b in prime:
					if a % b == 0:
						break
						#?´???°??????????????´????????????	
					else:
						if total == 0:
						#?´???°?¢?????????????
							prime.append(a)
						else:
						#?´???°??¢?´¢??°??????
							total -= 1
				if (a + 1) % 6 == 0:
					a += 2
				else:
					a += 5
			print(len(prime))

Python: import sys
import math

lines = str(sys.stdin.read()).strip().split("\n")

for line in lines:
    line = int(line)
    pList = []
    sList = list(reversed(list(range(3, line + 1))[::2]))
    while sList[-1] < math.ceil(math.sqrt(line)) + 1 :
        pList.append(sList.pop())
        for p in pList:
            sList = list(filter(lambda i: i % p != 0, sList))
    print(len(sList) + len(pList) + 1)

Python: while True:
    try:
        n = int(input())
    except:
        break

    a = [0 for i in range(n + 1)]

    # sieve
    i = 3
    while i * i <= n:
        for j in range(3 * i, n + 1, 2 * i): a[j] = 1
        i += 2

    count = int(n >= 2)
    count += sum(a[i] == 0 for i in range(3, n + 1, 2))
    print(count)

Python: from math import sqrt
def isprime(n):
    if n == 1:
        return 0
    if n == 2:
        return 1
    if n % 2 == 0:
        return 0
    for i in range(2,int(sqrt(n)+1)):
        if n % i == 0:
            return 0
    return 1

from sys import stdin
for i in stdin:
    i = int(i)
    print(sum(isprime(n) for n in range(2,i+1)))