LearnPy Hub
← Functions problems
Hard

Count Primes up to N

Write a helper function is_prime(n) and use it to count the primes from 2 to N.

Input

One integer N ≥ 1.

Output

The number of primes ≤ N.

Sample 1

Input
10
Output
4

Sample 2

Input
30
Output
10
solution.py
Output appears here
Hints
Count Primes up to N · Python practice problem · LearnPy Hub