Back
Close

Primes

Statement

 Goal

Given an integer n, print the number of primes p with p < n.
Example: n = 10 => answer == 4
2,3,5,7 are primes below 10
Input
n: upper limit for prime numbers
Output
count: number of primes smaller than n
Constraints
3 ⩽ n ⩽ 100000
Example
Input
11
Output
4

Game modes
Fastest, Shortest

Test cases
Test 1 Test
Input
11
Output
4

Validator 1 Validator
Input
12
Output
5

Test 2 Test
Input
5000
Output
669

Validator 2 Validator
Input
1000
Output
168

Test 3 Test
Input
10000
Output
1229

Validator 3 Validator
Input
11000
Output
1335

Test 4 Test
Input
100000
Output
9592

Validator 4 Validator
Input
100000
Output
9592

Solution language

Solution

Stub generator input