3 kyu

Prime counting

Description:

You need to count the number of prime numbers less than or equal to some natural n.

For example:

count_primes_less_than(34) = 11
count_primes_less_than(69) = 19
count_primes_less_than(420) = 81
count_primes_less_than(666) = 121
  • In this kata all the tests will be with 1n1010 1 \leqslant n \leqslant 10^{10}
  • Code length limited to 3000 characters to avoid hardcoding.

Good luck!

Mathematics
Recursion
Algorithms
Memoization
Performance
Number Theory

Similar Kata:

Stats:

CreatedDec 4, 2022
PublishedDec 4, 2022
Warriors Trained2071
Total Skips174
Total Code Submissions3696
Total Times Completed80
Python Completions80
Total Stars112
% of votes with a positive feedback rating82% of 22
Total "Very Satisfied" Votes16
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes2
Total Rank Assessments7
Average Assessed Rank
3 kyu
Highest Assessed Rank
2 kyu
Lowest Assessed Rank
3 kyu
Ad
Contributors
  • user8729270 Avatar
  • dfhwze Avatar
Ad