submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s817471102 | p00009 | Wrong Answer | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
N = 1000000
TABLE = [True] * N
def sieve():
TABLE[1] = False
for i in range(4, N, 2):
TABLE[i] = False
for i in range(6, N, 3):
TABLE[i] = False
for i in range(6, N, 6):
p1 = 6*i - 1
p2 = 6*i + 1
if p1 >= N: break
if TABLE[p1]:
for j in range(2*p1, N, p1):
TABLE[j] = False
if p2 >= N: break
if TABLE[p2]:
for j in range(2*p2, N, p2):
TABLE[j] = False
def main():
sieve()
for line in sys.stdin:
n = int(line)
cnt = sum(map(lambda k: TABLE[k], range(1, n+1)))
print(cnt)
if __name__ == "__main__": main() | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s136340088 | p00009 | Wrong Answer | import sys
import math
def Prime():
isPrime=[1 for i in range(0,1000000)]
isPrime[0]=isPrime[1]=0
numPrime=[0 for i in range(0,1000000)]
for i in range(2,int(math.sqrt(1000000)),1):
if isPrime[i]==1:
numPrime[i]=numPrime[i-1]+1
for j in range(i+i,1000000,i):
isPrime[j]=0
else:
numPrime[i]=numPrime[i-1]
for n in sys.stdin:
print(numPrime[int(n)])
#testWriteFile()
Prime() | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s501840009 | p00009 | Wrong Answer | import sys
import math
def Prime():
isPrime=[1 for i in range(0,1000000)]
isPrime[0]=isPrime[1]=0
numPrime=[0 for i in range(0,1000000)]
for i in range(2,int(math.sqrt(1000000)+1),1):
if isPrime[i]==1:
numPrime[i]=numPrime[i-1]+1
for j in range(i+i,1000000,i):
isPrime[j]=0
else:
numPrime[i]=numPrime[i-1]
for n in sys.stdin:
print(numPrime[int(n)])
#testWriteFile()
Prime() | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s066255681 | p00009 | Wrong Answer | 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) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s963280432 | p00009 | Wrong Answer | 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=[]
for k in range(1):
try:
num=int(input())
num_of_prime=0
for i in range(2,num+1):
if check_prime(int(math.sqrt(i))+1):
num_of_prime+=1
anss.append(num_of_prime)
except:
break
for ans in anss:
print(ans) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s887033873 | p00009 | Wrong Answer | 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=[]
for k in range(1):
try:
num=int(input())
num_of_prime=0
for i in range(2,num+1):
if check_prime(i):
num_of_prime+=1
anss.append(num_of_prime)
except:
break
for ans in anss:
print(ans) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s775777792 | p00009 | Wrong Answer | t = 0
while t == 0:
total = 0
try:
n = int(input())
except:
break
else:
print(total) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s984367305 | p00009 | Wrong Answer | def e(n):
array = [1]*(n+1)
k = 2
while k*k <= n:
if array[k] == 1:
i = k
while (i <= 10/k):
array[k*i] = 0
i += 1
k += 1
# ?´???°(array[i]==1)?????????
prime = []
i = 2
while i <= n:
if array[i] == 1:
prime.append(i)
i += 1
return len(prime)
while True:
try:
n = int(input())
print(e(n))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s753276160 | p00009 | Wrong Answer | t = 0
while t == 0:
prime = [2]
try:
n = int(input())
except:
break
#?¨??????\???????????????????¨????
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s057805712 | p00009 | Wrong Answer | 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)
elif n <= 4:
print(2)
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)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s074883807 | p00009 | Wrong Answer | 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)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s495127260 | p00009 | Wrong Answer | import sys
pr = [1]*1000000
pr[0] = 0
pr[1] = 0
for i in range(2,int(len(pr)/2)):
if pr[i]==1:
j = i*2
while j < int(len(pr)/2):
pr[j] = 0
j += i
print(pr[:100])
for line in sys.stdin:
n = int(line)
cnt = 0
for i in range(n+1):
if pr[i]==1:
cnt += 1
print(cnt) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s526253643 | p00009 | Wrong Answer | import sys
pr = [1]*1000000
pr[0] = 0
pr[1] = 0
for i in range(2,int(len(pr)/2)):
if pr[i]==1:
j = i*2
while j < int(len(pr)/2):
pr[j] = 0
j += i
for line in sys.stdin:
n = int(line)
cnt = 0
for i in range(n+1):
if pr[i]==1:
cnt += 1
print(cnt) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s519302855 | p00009 | Wrong Answer | import sys
pr = [1]*1000000
pr[0] = 0
pr[1] = 0
for i in range(2,int(len(pr)/2)+1):
if pr[i]==1:
j = i*2
while j < int(len(pr)/2)+1:
pr[j] = 0
j += i
for line in sys.stdin:
n = int(line)
cnt = 0
for i in range(n+1):
if pr[i]==1:
cnt += 1
print(cnt) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s863503078 | p00009 | Wrong Answer | import sys
import math
pr = [1]*1000000
pr[0] = 0
pr[1] = 0
maxval = math.ceil(math.sqrt(999999))
for i in range(2,maxval):
if pr[i]==1:
j = i*2
while j < maxval:
pr[j] = 0
j += i
for line in sys.stdin:
n = int(line)
cnt = 0
for i in range(n+1):
if pr[i]==1:
cnt += 1
print(cnt) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s385479994 | p00009 | Wrong Answer | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(2, q-1, q) == 1
t=0
while t == 0:
try:
x = int(input())
except:
break
else:
n = 1
if x == 0 or 1:
print(0)
elif x == 2:
print(1)
else:
for i in range(0,x + 1,2):
if is_prime(i):
n += 1
print(n) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s817466142 | p00009 | Wrong Answer | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(2, q-1, q) == 1
t=0
while t == 0:
try:
x = int(input())
except:
break
else:
n = 1
if x == 0 or 1:
print(0)
elif x == 2:
print(1)
else:
for i in range(0,x + 1,2):
if is_prime(i):
n += 1
print(n) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s865788149 | p00009 | Wrong Answer | import sys
MAX = 999999
L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
def is_prime(n):
if n == 2:return True
if n % 2 == 0:return False
for i in range(3,int(n**0.5)+1,2):
if n % i == 0:return False
return True
def is_prime_2(n):
a = int(n ** 0.5)
for i in L:
if i > a:return True
if n % i == 0:return False
return True
def prime_count(n):
result = 0
if n >= 2:result+=1
for i in range(3,n+1,2):
if is_prime_2(i):result+=1
return result
def prime_list(n):
result = []
if n >= 2:result.append(2)
for i in range(3,n+1,2):
if is_prime(i):result.append(i)
return result
L2 = prime_list(MAX)
def prime_count_2(n):
for i,v in enumerate(L2):
if n > v:return i
return len(L2)
for n in sys.stdin:
print(prime_count_2(int(n))) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s417153278 | p00009 | Wrong Answer | import sys
N = 1000
lst = [2]
for i in range(2, N)[1::2]:
lst.append(i)
for j in range(3, i):
if i % j == 0:
lst.pop(lst.index(i))
break
for i in sys.stdin:
for j in range(len(lst)):
if lst[j] > int(i):
print(j)
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s333706892 | p00009 | Wrong Answer | import sys
N = 1000000
lst = [1] * N
for i in range(3, int(N**0.5)+1, 2):
if lst[i] == 1:
lst[i*i::2*i] = [0] * len(lst[i*i::2*i])
lst = [2] + [i for i in range(3, N, 2) if lst[i] == 1]
print(lst[:100:])
for i in sys.stdin:
for j in range(len(lst)):
if lst[j] > int(i):
print(j)
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s394562176 | p00009 | Wrong Answer | import sys
N = 1000000
lst = [1] * N
for i in range(3, int(N**0.5)+1, 2):
if lst[i] == 1:
lst[i*i::2*i] = [0] * len(lst[i*i::2*i])
lst = [2] + [i for i in range(3, N, 2) if lst[i] == 1]
for i in sys.stdin:
for j in range(len(lst)):
if lst[j] > int(i):
print(j)
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s371142401 | p00009 | Wrong Answer | import sys
N = 1000000
lst = [1] * N
for i in range(3, int(N**0.5), 2):
if lst[i]:
lst[i*i::2*i] = [0] * len(lst[i*i::2*i])
lst = [2] + [i for i in range(3, N, 2) if lst[i]]
for i in sys.stdin:
for j in range(len(lst)):
if lst[j] > int(i):
print(j)
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s591254023 | p00009 | Wrong Answer | from sys import stdin
def prime(n: int) -> int:
Prime = [i for i in range(n+1)]
for i in range(2,n+1):
for j in range(2,int(n/i)+1):
Prime[i*j] = 0
Prime[0],Prime[1] = 0,0
print(Prime)
ans = [i for i in Prime if not(i == 0)]
return len(ans)
n = int(input())
print(prime(n)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s096408515 | p00009 | Wrong Answer | while True:
try:
n = int(raw_input())
count = [1] * (n + 1)
count[0],count[1]=0,0
for i in range(2, int(n**0.5)+1):
for j in range(i ** 2, (n + 1), i):
count[j] =0
for k in range(2, n+1):
count[k] += count[k-1]
print count[k]
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s140956269 | p00009 | Wrong Answer | while True:
try:
n = int(raw_input())
count = [1] * (n + 1)
count[0],count[1]=0,0
for i in range(2, int(n**0.5)+1):
for j in range(i ** 2, (n + 1), i):
count[j] =0
for k in range(2, n):
count[k] += count[k-1]
print count[k]
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s992401354 | p00009 | Wrong Answer | import sys
a=[0]*10**6
for i in range(1,10**6):a[i]=a[i-1]+int(2 in[i,pow(2,i,i)])
for e in sys.stdin:print(a[int(e)])
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s777253260 | p00009 | Wrong Answer | import sys
m=10**6;a=[1]*m;a[0:2]=0,0
for i in range(2,999):
if a[i]>0:
for j in range(i*2,m,i):a[j]=0
for e in sys.stdin:print(sum(a[:int(e)]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s174163956 | p00009 | Wrong Answer | import sys
a=[0,0]+[1]*10**6
for i in range(999):
if a[i]:a[i*2::i]=[0 for j in a[i*2::i]]
for e in sys.stdin:print(int(e)-len([i for i in a[:int(e)+1]if i]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s164046837 | p00009 | Wrong Answer | import sys
a=[0,0]+[1]*10**6
for i in range(999):
if a[i]:a[i*2::i]=[0 for j in a[i*2::i]]
for e in sys.stdin:print(int(e)-len([i for i in a[:int(e)]if i]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s563290459 | p00009 | Wrong Answer | import sys
a=[0,0,1]+[1,0]*5*10**5
for i in range(4,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]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s539261551 | p00009 | Wrong Answer | import sys
m=10**5//2
a=[0,0,1]+[1,0]*m
for i in range(4,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]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s927725158 | p00009 | Wrong Answer | import sys
m=10**5//2
a=[0,0,1]+[1,0]*m
for i in range(3,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]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s073445759 | p00009 | Wrong Answer | 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])
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s116997753 | p00009 | Wrong Answer | import sys
a=[1]*10**6
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])-e//2-1][e>3])
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s310879897 | p00009 | Wrong Answer | import sys
a=[1]*10**6
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])-(e-1)//2-1][e>3])
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s635318964 | p00009 | Wrong Answer | 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])
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s458713998 | p00009 | Wrong Answer | while True:
try:
r = int(input())
alist = []
for x in range(2, r+1):
if x != 2 and x != 3 and x != 5:
if x % 2 != 0 and x % 3 != 0 and x % 5 != 0:
alist.append(x)
else:
alist.append(x)
print(len(alist))
except EOFError:
break
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s883310652 | p00009 | Wrong Answer | def prime_judge(n):
if n==1:
return False
elif n==2:
return True
elif n%2==0:
return False
else:
sqrt_num=int(n**0.5)+1
for i in range(3,sqrt_num, 2):
if n%i==0:
return False
return True
prime=[0]
for i in range(1,100000):
if prime_judge(i):
prime.append(prime[-1]+1)
else:
prime.append(prime[-1])
while 1:
try:
print(prime[int(input())])
except:
break
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s675127993 | p00009 | Wrong Answer | LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, LIMIT + 1):
if prime[i - 1]:
for j in range(i ** 2, len(prime), i):
prime[j - 1] = 0
while True:
try:
n = int(input())
except EOFError:
break
print(n, sum(prime[:n]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s307025620 | p00009 | Wrong Answer | LIMIT = 999999
prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]
for i in range(3, LIMIT + 1):
if prime[i - 1]:
for j in range(i ** 2, len(prime), i):
prime[j - 1] = 0
while True:
try:
n = int(input())
except EOFError:
break
print(sum(prime[:n]))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s344584997 | p00009 | Wrong Answer | limit = int(input(""))
def primeNumber(number):
count = 0
for i in range(2,number+1):
if (number%i==0):
count = count + 1
if (count==1):
return True
else:
return False
sum = 0
for i in range(2,limit+1):
if (primeNumber(i)):
sum = sum + 1
print(sum)
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s994633512 | p00009 | Wrong Answer | limit = int(input(""))
def primeNumber(number):
count = 0
for i in range(2,number+1):
if (number%i==0):
count = count + 1
if (count==1):
return True
else:
return False
sum = 0
for i in range(2,limit+1):
if (i<2):
break
if (primeNumber(i)):
sum = sum + 1
print(sum)
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s521496209 | p00009 | Wrong Answer | limit = int(input(""))
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)
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s773208188 | p00009 | Wrong Answer | limit = int(input(""))
arr = [2,3,5,7]
def PrimeNumber(arr,number):
for i in arr:
if (number%i==0):
return False
return True
count = 0
for i in range(2,limit+1):
if(PrimeNumber(arr,i)):
arr.append(i)
count += 1
print(count)
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s458015058 | p00009 | Wrong Answer | limit = int(input(""))
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)
print()
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s463688804 | p00009 | Wrong Answer | limit = int(input(""))
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)
print()
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s452297662 | p00009 | Wrong Answer | q =[]
for t in range(2,10000):
for y in range(2,t):
if t % y==0:
break
else:
q.append(t)
while True:
try:
a = int(input())
for z in range(0,1000):
if a == 2:
break
elif q[z] >= a:
break
if q[0] == a:
print 1
else:
print z
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s043565364 | p00009 | Wrong Answer | import math
n = input()
c = 1
f = True
for i in range(3,n+1):
for j in range(2,math.trunc(math.sqrt(i))+1):
if i % j == 0: f = False
if f: c += 1
f = True
print c | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s797311087 | p00009 | Wrong Answer | import sys
n=10**6
s=[True]*n
s[0]=False
s[1]=False
for x in xrange(2, int(n**0.5)+1):
if s[x]:
for i in xrange(x+x,n,x):
s[i]=False
for x in sys.stdin.readlines():
x=int(x)
cnt=0
for i in xrange(x):
if s[i]:
cnt=cnt+1
print cnt | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s193228655 | p00009 | Wrong Answer | a = 10
primenumbers =[]
for i in range(2,a+1):
x = 0
for j in range(2,i+1):
if i % j == 0:
x = x+1
if x == 1:
primenumbers.append(i)
print len(primenumbers)
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s498152954 | p00009 | Wrong Answer | a = input()
primenumbers =[]
for i in range(2,a+1):
x = 0
for j in range(2,i+1):
if i % j == 0:
x = x+1
if x == 1:
primenumbers.append(i)
print len(primenumbers)
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s011465994 | p00009 | Wrong Answer | import time
n = 10**6
c = 0
ps = [False]*n
for i in xrange(2, n):
ps[i] = True
for i in xrange(2, int(n**0.5+1)):
if ps[i]:
for j in xrange(i**2, n, i):
ps[j] = False
while 1:
try:
n = input()
print len([0 for i in xrange(2, n) if ps[i]])
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s529871446 | p00009 | Wrong Answer | n = 10**6
c = 0
ps = [False]*n
for i in xrange(2, n):
if i%2 != 0 or i == 2:
ps[i] = True
for i in xrange(2, int(n**0.5+1)):
if ps[i]:
for j in xrange(i**2, n, i):
ps[j] = False
while 1:
try:
n = input()
if n == 2: print 1
else: print len([0 for i in xrange(2, n) if ps[i]])
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s730277059 | p00009 | Wrong Answer | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(2, q-1, q) == 1
primelist = []
for i in range(2,100000):
if is_prime(i) == True:
primelist.append(i)
x = int(raw_input())
for i in range(len(primelist)):
if x < primelist[i] :
print i
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s415268826 | p00009 | Wrong Answer | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(2, q-1, q) == 1
primelist = []
for i in range(2,100000):
if is_prime(i) == True:
primelist.append(i)
while True:
try:
x = int(raw_input())
for i in range(len(primelist)):
if x < primelist[i] :
print i
break
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s004206104 | p00009 | Wrong Answer | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(2, q-1, q) == 1
primelist = []
for i in range(2,1000000):
if is_prime(i) == True:
primelist.append(i)
while True:
try:
x = int(raw_input())
for i in range(len(primelist)):
if x < primelist[i] :
print i
break
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s325594506 | p00009 | Wrong Answer | N = 10 ** 5
sieve = map(lambda x:False, range(2, N + 1))
for i in range(2, N + 1):
if sieve[i - 2]:
continue
for j in range(i * 2, N + 1, i):
sieve[j - 2] = True
while True:
try:
n = int(raw_input())
except EOFError:
break
print sieve[:n - 1].count(False) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s535414963 | p00009 | Wrong Answer | import sys
max = 1000000
candidates = [True for x in range(0, max + 1)]
candidates[0] = False
candidates[1] = False
for i in range(2, max / 2):
if not candidates[i]:
continue
j = i + i
while True:
if max < j:
break
candidates[j] = False
j += i
for line in sys.stdin:
print len([i for i in candidates[0:int(line)] if i]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s566379332 | p00009 | Wrong Answer | while True:
try:
n = input()
print len([i for i in range(2,n) if 0 not in [i%j for j in range(2,int(sqrt(n)))]])
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s710976965 | p00009 | Wrong Answer | ps = []
for i in xrange(2,int(raw_input())+1):
isp = True
for j in ps:
if i%j==0: isp=False
if isp: ps.append(i)
print len(ps) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s006598402 | p00009 | Wrong Answer | ps = []
for i in xrange(2,int(raw_input())+1):
isp = True
for j in ps:
if i%j==0: isp=False
if isp: ps.append(i)
print str(len(ps)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s012604266 | p00009 | Wrong Answer | nyu = map(int,raw_input().split())
syu = ""
for a in nyu:
ps = []
for i in xrange(2,a+1):
isp = True
for j in ps:
if i%j==0:
isp = False
break
if isp: ps.append(i)
syu += str(len(ps)) +"\n"
print syu | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s897019264 | p00009 | Wrong Answer | nyu = map(int,raw_input().split())
syu = ""
saisyo = True
for a in nyu:
ps = []
for i in xrange(2,a+1):
isp = True
for j in ps:
if i%j==0:
isp = False
break
if isp: ps.append(i)
if saisyo:
syu += str(len(ps))
saisyo = False
else:
syu += "\n" + str(len(ps))
print syu | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s515216565 | p00009 | Wrong Answer | p = [0 for x in range(999999)]
for x in xrange(1,999999,2):
z = int(x**0.5)+1
for y in xrange(3,z,2):
if x % y == 0:
break
else:
p[x] = 1
n = input()
print sum(p[:n+1]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s532832877 | p00009 | Wrong Answer | p = [0 for x in range(999999)]
for x in xrange(1,999999,2):
z = int(x**0.5)+1
for y in xrange(3,z,2):
if x % y == 0:
break
else:
p[x] = 1
while 1:
try:
n = input()
print sum(p[:n+1])
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s092759899 | p00009 | Wrong Answer | 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) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s031960789 | p00009 | Wrong Answer | #!/usr/bin/env python
def get_pn(num, result):
if num == 1:
return result
else:
for i in range(2,num-1):
if (num % i) == 0:
break
else:
result.append(str(num))
return get_pn(num-1, result)
if __name__ == "__main__":
print '\n'.join(get_pn(int(raw_input()),[])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s812838777 | p00009 | Wrong Answer | import math
import sys
def countPrime(num):
primelist = []
for i in range(2, num+1):
primelist.append(i)
for i in range(10000000):
count = 0
check = primelist[i]
#print check
for num in primelist:
if num != check and num % check == 0:
primelist.pop(primelist.index(num))
count += 1
if count == 0:
break
#print primelist
return len(primelist)
def main():
nums = []
for num in sys.stdin:
nums.append(int(num))
for num in nums:
print countPrime(num) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s661933781 | p00009 | Wrong Answer | 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)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s482490393 | p00009 | Wrong Answer | import sys
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)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s378656241 | p00009 | Wrong Answer | 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(2):
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)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s438802940 | p00009 | Wrong Answer | import math
ans = []
while True:
try:
n = int(raw_input())
isPrime = [-1] * (n + 1)
isPrime[0], isPrime[1] = False, False
#isPrime[2] = True
i = 2
while i * i < n:
for j in range(i, n, i):
isPrime[j] = False
isPrime[i] = True
i = isPrime.index(-1)
ans.append(isPrime.count(True) + isPrime.count(-1))
except EOFError:
break
for num in ans:
print num | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s024290182 | p00009 | Wrong Answer | import math
ans = []
while True:
try:
n = int(raw_input())
isPrime = [-1] * (n + 1)
isPrime[0], isPrime[1] = False, False
#isPrime[2] = True
i = 2
while i * i < n:
for j in range(i, n+1, i):
isPrime[j] = False
isPrime[i] = True
i = isPrime.index(-1)
ans.append(isPrime.count(True) + isPrime.count(-1))
except EOFError:
break
for num in ans:
print num | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s116402198 | p00009 | Wrong Answer | import math
ans = []
while True:
try:
n = int(raw_input())
isPrime = [-1] * (n + 1)
isPrime[0], isPrime[1] = False, False
i = 2
while i * i < n:
for j in range(i, n+1, i):
isPrime[j] = False
isPrime[i] = True
i = isPrime.index(-1)
ans.append(isPrime.count(True) + isPrime.count(-1))
except EOFError:
break
for num in ans:
print num | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s609452748 | p00009 | Wrong Answer | import math
ans = []
while True:
try:
n = int(raw_input())
isPrime = [-1] * (n + 1)
isPrime[0], isPrime[1] = False, False
i = 2
while i * i < n:
for j in range(i, n+1 ,i):
#print "%d,"%(j),
isPrime[j] = False
isPrime[i] = True
i = isPrime.index(-1)
ans.append(isPrime.count(True) + isPrime.count(-1))
except EOFError:
break
for num in ans:
print num | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s010656290 | p00009 | Wrong Answer | while True:
try:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(2,n):
j = 2
while k < n:
k = i*j
filter[k-1] = 0
j += 1
sum = 0
for i in filter:
sum += i
print sum
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s356867589 | p00009 | Wrong Answer | import math
while True:
try:
n = int(raw_input())
prime=[]
if n < 3:
print n-1
break
for i in range(3, n+1, 2):
isprime = 1
sqrt = int(math.sqrt(i))
for j in prime:
if i % j == 0:
isprime = 0
break
if j > sqrt:
break
if isprime:
prime.append(i)
print len(prime)
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s323381037 | p00009 | Wrong Answer | import math
while True:
try:
n = int(raw_input())
prime=[]
if n < 3:
print n-1
break
for i in range(3, n+1, 2):
isprime = 1
sqrt = int(math.sqrt(i))
for j in prime:
if i % j == 0:
isprime = 0
break
if j > sqrt:
break
if isprime:
prime.append(i)
print len(prime)+1
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s519311492 | p00009 | Wrong Answer | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = 0
for i in range(3,sqrt,2):
for j in range(2*i,r,i):
prime[j] = 0
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s361204388 | p00009 | Wrong Answer | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = 0
for i in range(3,sqrt,2):
for j in range(2*i,r,i):
prime[j-1] = 0
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s447486805 | p00009 | Wrong Answer | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in prime:
if i:
for j in range(2*i,r+1,i):
prime[j-1] = 0
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s507312706 | p00009 | Wrong Answer | import math
n = []
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[1::2] = [0 for x in range(0,r,2)]
for i in range(2,sqrt,2):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
for i in n:
print sum(p[:i]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s381224635 | p00009 | Wrong Answer | import math
n = []
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[1::2] = [0 for x in range(1,r,2)]
for i in range(2,sqrt,2):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
for i in n:
print sum(p[:i]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s308263325 | p00009 | Wrong Answer | def isPrime(p):
if p == 2: return 1
if p < 2 or p&1 == 0: return 0
return 1 if pow(2,p-1,p) == 1 else 0
n = int(raw_input())
print sum(isPrime(i) for i in range(1,n+1)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s741848627 | p00009 | Wrong Answer | #!/usr/bin/python
import math
def sieve(n):
nums = [i+1 for i in range(2, n, 2) if (i+1) % 3 != 0 and (i+1) % 5 !=0]
ans = [2,3,5]
while nums[0] <= math.sqrt(n):
for i in range(nums[0]**2, nums[-1]+1, nums[0]):
if i in nums: nums.remove(i)
ans.append(nums.pop(0))
ans += nums
return len(ans)
while True:
try:
print sieve(input())
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s289963453 | p00009 | Wrong Answer | #!/usr/bin/python
import math
def sieve(n):
if n==1:
return 0
elif n<=2:
return 1
elif n<=3:
return 2
elif n<=5:
return 3
nums = [i+1 for i in range(2, n, 2) if (i+1) % 3 != 0 and (i+1) % 5 !=0]
ans = [2,3,5]
while nums[0] <= math.sqrt(n):
for i in range(nums[0]**2, nums[-1]+1, nums[0]):
if i in nums: nums.remove(i)
ans.append(nums.pop(0))
ans += nums
return len(ans)
while True:
try:
print sieve(input())
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s951158036 | p00009 | Wrong Answer | from bisect import bisect
def sieve(n):
num = [True]*n
num[0] = num[1] = False
for i in xrange(2,int(n**0.5)+1):
if num[i]:
for j in xrange(i**2, n, i):
num[j] = False
return [i for i in xrange(2,n) if num[i]]
prime = sieve(10000)
while True:
try:
print bisect(prime, input())
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s062971908 | p00009 | Wrong Answer | from bisect import bisect
def sieve(n):
num = [True]*n
num[0] = num[1] = False
for i in xrange(2,int(n**0.5)+1):
if num[i]:
for j in xrange(i**2, n, i):
num[j] = False
return [i for i in xrange(2,n) if num[i]]
prime = sieve(999999)
while True:
try:
print bisect(is_prime, input())
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s459927314 | p00009 | Wrong Answer | number = int(raw_input())
result = []
for i in range(2,number+1):
for j in range(2,i+1):
if i == j:
result.append(i)
elif i % j == 0:
break
print len(result) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s816415089 | p00009 | Wrong Answer | era=[]
while True:
try:
n = int(raw_input())
for i in xrange(n+1):
era.append(1)
ans=0
for i in xrange(2,n+1):
if era[i]==1:
ans += 1
for j in xrange(i,n+1,i):
era[j]=0
print ans
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s566524435 | p00009 | Wrong Answer | # coding: utf-8
import math
def sieve_of_erastosthenes(input_list):
for num in input_list:
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
print(len(multiple_list + serial_number_list))
if __name__ == '__main__':
input_list = []
while True:
try:
input_list.append(int(input()))
except:
break
sieve_of_erastosthenes(input_list) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s218274611 | p00009 | Wrong Answer | # coding: utf-8
import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
if serial >= sqrt:
# print([i for i, b in enumerate(input_list) if b == True])
return sum(input_list)
for s in range(serial ** 2, num, serial):
input_list[s] = False
if __name__ == '__main__':
while True:
try:
print(sieve_of_erastosthenes(int(input())))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s706865172 | p00009 | Wrong Answer | import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
if serial >= sqrt:
return sum(input_list)
for s in range(serial ** 2, num, serial):
input_list[s] = False
if __name__ == '__main__':
while True:
try:
print(sieve_of_erastosthenes(int(input())))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s507703650 | p00009 | Wrong Answer | import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
if serial >= sqrt:
return input_list
if input_list[serial] is True:
for s in range(serial ** 2, num, serial):
input_list[s] = False
if __name__ == '__main__':
while True:
try:
n = int(input())
except:
break
if 5 >= n:
print(1)
else:
input_list = sieve_of_erastosthenes(n)
print(sum(input_list)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s415493739 | p00009 | Wrong Answer | def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
for serial in range(3, int(num ** 0.5) + 1, 2):
if input_list[serial] is True:
for s in range(serial ** 2, num, serial):
input_list[s] = False
# print([i for i, b in enumerate(input_list) if b == True])
return sum(input_list)
if __name__ == '__main__':
while True:
try:
n = int(input())
except:
break
if 5 >= n:
print(1)
else:
print(sieve_of_erastosthenes(n)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s008109763 | p00009 | Wrong Answer | def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
for serial in range(3, int(num ** 0.5) + 1, 2):
if input_list[serial] is True:
for s in range(serial ** 2, num, serial):
input_list[s] = False
return sum(input_list)
print(sieve_of_erastosthenes(1000000)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s281058931 | p00009 | Wrong Answer | def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
for serial in range(3, int(num ** 0.5) + 1, 2):
if input_list[serial] is True:
for s in range(serial ** 2, num, serial):
input_list[s] = False
return sum(input_list)
print(sieve_of_erastosthenes(999999)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s074600967 | p00009 | Wrong Answer | 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)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s324265233 | p00009 | Time Limit Exceeded | import math
import sys
def prime_calc(n):
if n < 2:
return False
elif n==2 or n==3 or n==5 or n==7:
return True
else:
rootN = math.floor(math.sqrt(n))
i = 11
while rootN > i:
if n % i == 0:
return False
else:
i += 2
return True
def prime(n):
cnt = 0
for i in range(2, 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()
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s512484138 | p00009 | Time Limit Exceeded | def eratosthenes(N):
prime=[]
a=[2]+list(range(3,N+1,2))
end=N**0.5
while len(a) and a[0]<=end:
nn=a.pop(0)
prime.append(nn)
a=[i for i in a if i%nn!=0]
prime+=a
return prime
while True:
try:
n=int(input().strip())
print(len(eratosthenes(n)))
except:
break
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.