Go: package main

import (
  "fmt"
  "math"
)

func main() {
  const N = 1000000
  var temp [N+1]bool
  for i:=0; i<N+1; i++ {
    temp[i] = true
  }
  temp[0] = false
  temp[1] = false
  for i:=2; i<int(math.Ceil(math.Sqrt(float64(N+1)))); i++{
    if (temp[i]){
      for j:=i*2; j<N+1; j+=i{
        temp[j] =false
      }
    }
  }
  var a int
  var b int
  for _, err := fmt.Scan(&a); err == nil; _, err = fmt.Scan(&a) {
    b = 0
    for i:=0; i<=a; i++{
      if temp[i] {
        b++
      }
    }
    fmt.Println(b)
  }
}

Python: import math

def yo(n):
    if n==1:    return False
    s=2
    while s <= int(math.sqrt(n)):
        if n%s == 0:    return False
        s+=1
    return True

while True:
    c=0
    try:
        for i in range(1, int(input())+1):
            if yo(i)==True:    c+=1
        print(c)
    except:
        break

Python: import math

while(1):
    try:
        n = int(input())
    except:
        break

    m = int(math.sqrt(n))
    keys = [n // i for i in range(1, m+1)]
    keys += range(keys[-1]-1, 0, -1)
    h = {i: i-1 for i in keys}

    for i in range(2, m+1):
        if h[i] > h[i-1]:
            hp = h[i-1]
            i2 = i*i
            for j in keys:
                if j < i2:
                    break
                h[j] -= h[j // i] - hp
    print(h[n])

Python: from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[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
    cash[n] = 1
    return 1

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

Python: import sys

values = []
for line in sys.stdin:
    if 1000000 > int(line):
        values.append(line)

for val in values:
    prime = 0
    for i in range(2, val // 2):
        if val % i != 0:
            prime += 1
    print(prime)

Python: import sys
a=[0,0]+[1]*10**6
for i in range(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: while 1:
    try:
        count=0;
        x=int(input())
        if x==1:
            print(0)
        elif x==2:
            print(1)
        else:
            a=[int(i) for i in range(2,x+1)]
            for i in  range(len(a)):
                count1=0
                for j in range(2,a[i]):
                    if a[i]%j==0:
                        count1+=1
                if count1==0:
                    count+=1
            print(count)        
    except EOFError:
        break

Python: try:
    while True:
        n=int(input())
        nums = range(2, n+1)
        res = list(range(2, n+1))
        for a in nums:
            if a in res:
                tmp = []
                for b in res:
                    if b<=a or b % a != 0:
                        tmp.append(b)
                res = tmp
        print(len(res))
except:
    pass

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] < int(math.ceil(math.sqrt(line))) + 1 :
        pList.append(sList.pop())
        for p in pList:
            sList = list(filter(lambda i: i % p != 0, sList))
    pList.extend(sList)
    pList.append(2)
    print(len(pList))

Python: import sys
import math
M = 1000000
B = int(math.sqrt(M)+1)
N = M//6
N1 = N+1 if M % 6 == 5 else N
N2 = N+1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
for i in range(5,B,6):
    p = (i-5)//6
    ini = (i*5-1)//6
    if l[p] == 1:
        l[p+i::i] = [0] * len(l[p+i::i])
        m[ini-1::i] = [0] * len(m[ini-1::i])
    if m[p] == 1:
        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])
        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])

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

Python: while True:
    try:
        n=int(input())
    except:
        break
    print(sum(i==2 or pow(2,i-1,i)==1 for i in range(2,n+1)))

Python: import sys
import math

N = 1000000
primes = [1] * (N//2+1)
primes[0] = 1

for i in range(3,int(math.sqrt(N))+1,2):
    if primes[i//2]:
        primes[(i*i)//2::i] = [0] * len(primes[(i*i)//2::i])
    primes[i//2] += primes[i//2-1]

for i in range(int(math.sqrt(N))+1,N+1,2):
    primes[i//2] += primes[i//2-1]


for i in sys.stdin:
    n = int(i)
    if n == 1:
        print(0)
    elif n == 2:
        print(1)
    else:
        print(primes[(n-1)//2])

Python: # coding: utf-8

import math

def sieve_of_erastosthenes(num):

    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

    return len(multiple_list + serial_number_list)

if __name__ == '__main__':
    input_list = []
    
    while True:
        try:
            print(sieve_of_erastosthenes(int(input())))
        except:
            break

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

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def eratosthenes_sieve(n):
    """ 素数列挙(エラトステネスの篩) """

    table = [0] * (n + 1)
    prime_list = []
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(i + i, n + 1, i):
                table[j] = 1
    return prime_list

N = 1000000
primes = eratosthenes_sieve(N)
A = [0] * 1000000
for p in primes:
    A[p] = 1
acc = list(accumulate(A))

while True:
    try:
        a = INT()
        print(acc[a])
    except:
        # 入力が取れなかったら終了
        break

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

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

N = input()
a = []
lists = []
for line in sys.stdin:
    # a.append(input())
    # print(line)
    x= list(range(2,(int(line)+1)))
    print(len(flatten(Eratos(x))))

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

# print(len(flatten(ans)))