Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var primeCount int
	for sc.Scan() {
		input := nextInt()
		for i := 0; i <= input; i++ {
			if IsPrime(i) {
				primeCount++
			}
		}
		fmt.Printf("%d\n", primeCount)
		primeCount = 0
	}
}

func IsPrime(num int) bool {
	switch {
	case num == 2 || num == 5:
		return true
	case num < 2 || num%2 == 0 || num%5 == 0:
		return false
	}
	sqrt := math.Sqrt(float64(num))
	for i := 3; i <= int(sqrt); i += 2 {
		if num%i == 0 {
			return false
		}
	}
	return true
}

func next() string {
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

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
while True:
    try:
        n = int(input())
        print(len(list(filter(lambda x:x, erato(n)))))
    except:
        break

Python: # -*- coding: utf-8 -*-
from math import sqrt
from bisect import bisect

def inpl(): return tuple(map(int, input().split()))

def primes(N):
    P = [2]
    searched = [False]*(N+1)
    for i in range(3, N+1, 2):
        if searched[i]:
            continue
        P.append(i)
        for j in range(i, N+1, i):
            searched[j] = True
    return P

P = primes(10**6)

try:
    while True:
        print(bisect(P, int(input())))
except:
  pass

Python: def sieve_prime(n): # return prime numbers within [1, n]
  primes = []
  is_prime = [True] * (n+1) # [0, n]
  for i in range(2, n+1):
    if not is_prime[i]:
      continue # need only primes

    primes.append(i)
    for j in range(i*2, n+1, i): # range(i*2, n+1, i) = {i*2, i*3, ...}
      is_prime[j] = False

    """
    Compare the above code with the below one in the view of time complexity
    for j in range(i*2, n+1):
      if j % i == 0:
        is_prime[j] = False
    """
        
  return primes
      
while True:
  try:
    n = int(input())
    print(len(sieve_prime(n))) # because T <= 30, you can simply use sieve_prime every time
  except EOFError:
    break

Python: while t == 0:	
	total = 0
	try:
		n = int(input())
	except:
		break
	else:
	        print(total)

Python: import math

a = [1]*1000000
for i in range(2,1000000):
    for j in range(i+i,1000000)[::i]:
        a[j] = 0

b = [0]*1000000
b[0] = b[1] = 0
for i in range(2,1000000):
    if a[i] == 1:
        b[i] = b[i-1] + 1
    else:
        b[i] = b[i-1]

while True:
    try:
        print(b[int(input())])
    except EOFError:
        break

Python: def Eratosthenes(n):
	N = {i:True for i in range(2,n+1)}
	primeNumbers = []
	for i in range(2,n+1):
		if N[i]:
			primeNumbers.append(i)
			j = i*2
			while j<=n:
				N.update({j:False})
				j += i
	return primeNumbers

while True:
	P = Eratosthenes(999999)
	try:
		n = int(input())
	except EOFError:
		break
	cnt = 0
	for x in P:
		if x>n:
			break
		cnt += 1
	print(cnt)

Python: from sys import stdin

for limit in stdin:
    limit = int(limit)
    arr = [2,3,5,7]
    def PrimeNumber(arr,number):
        for i in arr:
            if (number%i==0):
                return False
        return True

    for i in range(2,limit+1):
        if(PrimeNumber(arr,i)):
            arr.append(i)
            
    count = 0
    for i in arr:
        if (i>limit):
            break
        else:
            count += 1

    print(count)

Python: import sys


def primes(n):
    f = []
    for i in range(n + 1):
        if i > 2 and i % 2 == 0:
            f.append(0)
        else:
            f.append(1)
    i = 3
    while i * i <= n:
        if f[i] == 1:
            j = i * i
            while j <= n:
                f[j] = 0
                j += i + i
        i += 2
    return f[2:]


if __name__ == "__main__":
    ps = primes(100)
    for n in sys.stdin:
        i = int(n)
        if i < 2:
            print(i, 0)
        else:
            print(i, sum(ps[:i - 1]))

Python: import bisect 


def make_prime_numbers(n):
    """n以下の素数を列挙したリストを出力する
    計算量: O(NloglogN)
    入出力例: 30 -> [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
    """
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(2 * i, n + 1, i):
            is_prime[j] = False
    prime_numbers = [i for i in range(n + 1) if is_prime[i]]
    return prime_numbers


prime_numbers = make_prime_numbers(10 ** 6)
while True:
    try:
        n = int(input())
    except:
        break
    print(bisect.bisect_right(prime_numbers, n))

Python: try:
    while True:
        n = int(input())
        datasets = list(range(2, n+1))
        answers = set([])
        while datasets:
            i = datasets[0]
            datasets = filter(lambda data: data%i != 0, datasets)
            answers.add(i)
        print(len(answers))
except:
    pass

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

while True:
    try:
        n = int(input())
    except:
        break
    ans = 0
    while n > 0:
        ans += primes[n]
        n -= 1
    print(ans)

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

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 map(int,sys.stdin):
 print((e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])+2)[e>3])

Python: # -*- coding: utf-8 -*-
import sys
array=[]
for i in sys.stdin:
    array.append(int(i))
m=max(array)
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*i,m+1,i):
            prime[j]=0
for i in range(len(array)):
    print(sum(prime[:array[i]+1]))

Python: M = 10**6

p = [0]*(M+60)
sM = M**0.5
for x in range(1, int(sM/2)+1):
    v = 4*x*x + 1; y = 8
    while v <= M:
        if v % 12 != 9: # v % 12 in [1, 5]
            p[v] ^= 1
        v += y; y += 8
for x in range(1, int(sM/3**0.5)+1, 2):
    v = 3*x*x + 4; y = 12
    while v <= M:
        if v % 12 == 7:
            p[v] ^= 1
        v += y; y += 8
for x in range(2, int(sM/2**0.5)+1):
    v = 2*x*(x+1)-1; y = 4*x-8
    while 0 <= y and v <= M:
        if v % 12 == 11:
            p[v] ^= 1
        v += y; y -= 8

for n in range(5, int(sM)+1):
    if p[n]:
        for z in range(n*n, M, n*n):
            p[z] = 0
p[2] = p[3] = 1

c = [0]*M
cnt = 0
for i in range(M):
    if p[i]:
        cnt += 1
    c[i] = cnt

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

Python: import math as m
n=int(input())
a=[0]*(n+1)
a[0],a[1]=1,1
for i in range(2,int(m.sqrt(n))+1):
	for j in range(2,int(n/i)+1):
		a[i*j]=1
print(a.count(0))

Python: import sys

def prime_calc(n):
    if n < 2:
        return False
    else:
        i = 2
        while n > i:
            if n % i == 0:
                return False
            else:
                i += 1
    return True

def prime(n):
    cnt = 0
    for i in range(0, n+1):
        ans = prime_calc(i)
        if ans is True:
            cnt = cnt + 1

    return cnt

def main():
    l = []
    
    for line in sys.stdin:
        l.append(int(line))

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

if __name__ == "__main__":
    main()