Number of Primes

3

2 votes
Mathematics, Sieve, Very-Easy, Number theory
Problem

Given a number N, find number of primes in the range [1,N].

Input:
The only line of input consists of a number N.

Output:
Print the number of primes in the range [1,N].

Constraints:
1N1000000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There are four primes in the range [1,10]: 2,3,5,7

Editor Image

?