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 sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def primes_for(n):
   is_prime = [True] * (n + 1)
   is_prime[0] = False
   is_prime[1] = False
   for i in range(2, n + 1):
       for j in range(i * 2, n + 1, i):
           is_prime[j] = False
   return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes_for(10**6)
is_prime = [0]*10**6
for n in prime_list:
  is_prime[n] = 1

cnt = [0] * 10**6
for i in range(2, 10**6):
  if is_prime[i]:
    cnt[i] = cnt[i-1] + 1
  else:
    cnt[i] = cnt[i-1]

while 1:
  try:
    n = INT()
    print(cnt[n])
  except:
    sys.exit()

Python: import itertools, functools, math, sys

def prime_stream():
    stream = itertools.count(2)
    sieve = lambda x, y: x % y != 0

    while True:
        prime = next(stream)
        stream = filter(functools.partial(sieve, y=prime), stream)
        yield prime

for line in sys.stdin:
    primes = prime_stream()
    num = int(line)
    count = 0
    for i in range(num):
        if next(primes) > num:
            break
        count += 1
    print(count)

Python: import sys,random

rand = random.randint

def prime(n):
	if n == 2:
		return True
	if n < 2 or n & 1 == 0:
		return False
	d = (n-1) >> 1
	while d & 1 == 0:
		d >>= 1
	
	for i in range(3):
		a = rand(1,n-1)
		t = d
		y = pow(a,t,n)
		while t != n-1 and y != 1 and y != n-1:
			y = pow(y,2,n)
			t <<= 1
		if y != n-1 and t & 1 == 0:
			return False
	return True

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

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

Python: import argparse

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

    return 1

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

    return cnt

def main():
    l = []
    
    parser = argparse.ArgumentParser()
    parser.add_argument("filename", help="The filename to be processed")
    args = parser.parse_args()

    if args.filename:
        with open(args.filename) as f:
            for line in f:
                a = int(line.rstrip())
                l.append(a)


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

if __name__ == "__main__":
    main()

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

Python: # PrimeNumber
# エラトステネスの篩

import math

if __name__ == "__main__":
    while True:
        try:
            # 数値の入力があった
            n = int(input())
            nlist = []
            nlist2 = []
            plist = []

            # for i in range(2, n + 1):
            #    nlist.append(i)  # [2,3,4,5,6,...,n]
            nlist = range(3, n + 1, 2)

            while True:
                #print(nlist, " ", math.sqrt(n))
                sqrtn = math.sqrt(n)
                if nlist[0] > sqrtn:  # 終了条件
                    #plist.append(map(int,nlist))
                    plist.extend(nlist)
                    break
                else:
                    plist.append(nlist[0])

                    #i = 0
                    for j in nlist:
                        if j % nlist[0] != 0:
                            #nlist.pop(i)
                            #nlist.remove(j)
                            nlist2.append(j)
                            #i += 1
                    nlist = nlist2
                    nlist2 = []
            #print("fin: {}".format(plist))
            print(len(plist)+1) # 2の分を追加

        except EOFError:
            break  # escape from while loop

pass
#

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

while True:
    try:
        n = int(raw_input())
        if n < 3:
            print(0)
            continue
        list1 = range(2, n)
        list2 = []
        while True:
            i = list1.pop(0)
            list2.append(i)
            for x in list1:
                if x % i == 0:
                    list1.remove(x)
            if i**2 > list1[::-1][0]:
                break
        print(len(list2 + list1))
    except EOFError:
        break

Python: import math

def isprime(n):
 if n==2:
  return True
 if n<2 or n%2==0:
  return False
 i=3
 while i<=math.sqrt(n):
  if n%i==0:
   return False
  i=i+2
 return True

while True:
 try:
  n=int(input())
  L=[i for i in range(n+1) if isprime(i)]
  print(len(L))
 except EOFError:
  break

Python: while True:
    try:
        n = int(input())
        prime_cnt = 0

        for i in range(2, n+1):
            cnt = 0
            for j in range(1,i):
                if i % j == 0:
                    cnt = cnt + 1
                    
            if cnt == 1:
                #?´???°
                prime_cnt = prime_cnt + 1
                

        print(str(prime_cnt))
    except:
        break

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(0)
        else:
            print(sum(ps[:i - 1]))

Python: import sys
from math import sqrt, floor


def is_prime(n):
    for i in range(3, floor(sqrt(n)) + 1, 2):
        if not n % i:
            return False
    return True


def count_prime(input_list):
    count = int(max(input_list) > 1)
    inset = sorted((n, i) for i, n in enumerate(input_list))
    i = 3
    for t in inset:
        t0 = t[0]
        while i <= t0:
            count += is_prime(i)
            i += 2
        yield (t[1], str(count))


print('\n'.join(t[1] for t in sorted(count_prime(list(map(int, sys.stdin))))))