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

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)))

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))