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: import sys

def Input(sequence):
    '''
    ??\????????????????????§??????????????????
    :param sequence: ??????????????????????????????
    :return:
    '''
    for line in sys.stdin:
        try:
            sequence.append(int(line))
        except ValueError:
            break

def SearchPrimeNumber(sequence):
    '''
    ??\???????????§????´???°?????????????????¨??????????????????
    :param sequence: ??\???????????????
    :return:
    '''
    for val in values:
        prime = 0
        for i in range(2, val + 1):
            for j in range(2, i + 1):
               if i % j == 0:
                # 1???????????§??????????????????????????´???????´???°
                    if i == j:
                        prime += 1
                    else:
                        break
        print(prime)

if __name__ == '__main__':
    values = []
    Input(values)
    SearchPrimeNumber(values)

Python: import sys
prime = [0]
isPrime = [1 for i in range(1000000)]
isPrime[0] = 0
isPrime[1] = 0
for i in sys.stdin:
    n = int(i)
    if prime[len(prime)-1] < n:
        for i in range(prime[len(prime)-1]+1,n+1):
            if isPrime[i] == 1:
                prime.append(i)
                for j in range(i*2, 1000000, i):
                    isPrime[j] = 0
    print(sum(isPrime[:n+1]))

Python: while True:
  a=int(input())
  X=[i for i in range(2,a+1)]
  Y=[]
  while True:
    X=[i for i in X if i % X[0] !=0 ]
    if X == Y:
      break
    Y=X[:]
  
  print(len(X))

Python: b=[]
b.append(1)
b.append(2)
count=1
s=0
while s<30:
    try:
        x=int(input())
        if x>b[count]:
            for i in range(b[count]+1,x+1):
                count1=0
                for j in range(2,i):
                    if i%j==0:
                        count1=1
                        break
                if count1==0:
                    count+=1
                    b.append(i)
            print(count)
        else:
            for i in range(count+1):
                if b[i]>x:
                    print(i-1)
                    break
                elif b[i]==x:
                    print(i)
                    break
        s+=1
    except EOFError:
        break

Python: import sys

primes = [1] * 500000
primes[0] = 0

for i in range(3, 1000, 2):
    if primes[i // 2]:
        primes[(i * i) // 2::i] = [0] * len(primes[(i * i) // 2::i])

for i in sys.stdin:
    n = int(i)
    if n < 4:
        print(n - 1)
    else:
        print(sum(primes[:(n + 1) // 2]) + 1)

Python: is_prime = [i for i in range(1000000)]

is_prime[0] = is_prime[1] = False

for i in range(2,1000000):
    is_prime[i] = True

for i in range(2,1000000):
    if i*i >= 1000000:
        break
    if is_prime[i]:
        for j in range(i*i,1000000,i):
            is_prime[j] = False

n_prime = [i for i in range(1000000)]

def main():
    cnt = 0
    for i in range(1000000):
        if is_prime[i]:
            cnt += 1
        n_prime[i] = cnt

    while 1:
        try:
            n = int(input())
            print(n_prime[n])
        except:
            break

if __name__ == "__main__":
    main()

Python: import sys
[print(sum([1 if sum([0 if y % z != 0 else 1 for z in range(2, y)]) == 0 else 0 for y in [y + 1 for y in range(2, x)]]) + 1) for x in [int(x) for x in sys.stdin]]

Python: lis=[True for i in range(int(1e6+1))]

lis[0]=lis[1]=False
end=int(1e6**0.5)
for i in range(end+1):
    if lis[i]:
        for j in range(i*2,int(1e6+1),i):
            lis[j]=False

while True:
    try:
        n=int(input())
        cnt=0
        for i in range(n+1):
            if lis[i]:cnt+=1
        print(cnt)
        
        
    except EOFError:
        break

Python: import sys
def main():
    for line in sys.stdin:
        n = int(line)
        hoge = [i for i in range(2, n + 1) if i % 2 != 0 or i == 2]
        fuga = [2]
        for i in range(1, len(hoge)):
            cnt = 0
            for j in range(i):
                if hoge[i] % hoge[j] != 0:
                    cnt += 1
            if cnt == i:
                fuga.append(hoge[i])
        print(len(fuga))


if __name__ == "__main__":
    main()

Python: #coding:utf-8
import time
import math
import numpy as np

def flatten(L):
    if isinstance(L, list):
        if L == []:
            return []
        else:
            return flatten(L[0]) + flatten(L[1:])
    else:
        return [L]

def Eratos(data):

    p_list = [] # ????????????
    tmp = []
    num = int(math.sqrt(len(data)))+1
    for i in data:
        i=data[0]
        if i>num:
            break
        else:
            p_list.append(i)
            for j in data:
                if j%i == 0:
                    data.remove(j)
        
    p_list.append(data)
    return p_list

x = int(input())

r_list = list(range(2,(x+1)))
ans = []
ans = Eratos(r_list)

print("prime numbers is ")

print(len(flatten(ans)))

Python: import sys

primes = [2]
for line in sys.stdin:
  try:
    n = int(line)
    if n > max(primes):
      for i in range(max(primes) + 1, n + 1):
        if i % 2 == 0 or len([j for j in primes if i % j == 0]) > 0:
          continue
        primes.append(i)
    ans = [i for i in primes if i <= n]
    print(len(ans))
  except:
    break

Python: import math
import sys

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

nums = [1] * (n+1)
nums[:2] = [0,0]
    
cnt = 0
while cnt <= math.sqrt(n):
    flg = nums[cnt]
    if flg == 1:
        k = 2
        while k*cnt <= n:
            nums[k*cnt] = 0
            k += 1
    cnt += 1
sum(nums)

Python: import sys
for line in sys.stdin:
    n = int(line)
    flag = [True]*(n+1)
    flag[0] = flag[1] = False
    for i in range(2,int(n**0.5)+1):
        if flag[i]:
            for j in range(i**2, n+1, i):
                flag[j] = False
    print(flag.count(True))

Python: max_num = 1000000
cnt = 0
p = [1] * max_num
p[0] = p[1] = 0
for i in xrange(2, int(max_num ** 0.5) + 1):
    if p[i]:
        p[i * i::i] = [0] * len(p[i * i::i])

for i in xrange(max_num):
    cnt += p[i]
    p[i] = cnt

while True:
    try: print(p[int(raw_input())])
    except: break

Python: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def enum_prime(n):
    if n < 2:
        return []
    if n == 2:
        return [2]
    L = list(range(2, n + 1))
    PL = []
    while True:
        PL.append(L[0])
        L = [i for i in L if i % PL[-1] != 0]
        if L[-1] < PL[-1] ** 2:
            return PL + L

primelist = enum_prime(999999)
for line in stdin:
    n = int(line)
    cnt = 0
    for p in primelist:
        if n < p:
            break
        cnt += 1
    print(cnt)

Python: LIMIT = 10000000
 
isPrime = [True for _ in range(LIMIT)]

isPrime[0] = isPrime[1] = False
 
for i in range(2, int(LIMIT ** 0.5)+1):
  if isPrime[i]:
    for j in range(i * i, LIMIT, i):
      isPrime[j] = False
 
try:
    while True:
        n = int(input())

        count = 0
        if n >= 2:
            count = 1

        for i in range(3, n+1, 2):
            if isPrime[i]:
                count += 1

        print(count)
except EOFError:
  pass