FunctionRacerProblemsRace

Count Primes

MediumMathPython, JavaScript, TypeScript, Java, C++

Return how many prime numbers are strictly less than n.

Example 1

n 10
returns 4

2, 3, 5 and 7.

Example 2

n 2
returns 0

No prime is below 2.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems