LearnPy Hub
← Loops problems
Hard

Count the Primes Quickly

Read n (up to 300000) and print how many primes are ≤ n, then the largest prime ≤ n (or none). Use the Sieve of Eratosthenes: a list of True values where you cross out multiples.

Input

One integer n ≥ 1.

Output

Two lines.

Sample 1

Input
10
Output
4
7

Sample 2

Input
1
Output
0
none
solution.py
Output appears here
Count the Primes Quickly · Python practice problem · LearnPy Hub