Find all prime numbers up to N
Find all prime numbers up to N
Write a function to find all prime numbers up to a given number N using the Sieve of Eratosthenes algorithm.
Test Cases5 test cases
Test Cases:
Showing 2 of 3 sample test casesTest Case 1
Input:
{
"n": 10
}Expected Output:
[ 2, 3, 5, 7 ]
Test Case 2
Input:
{
"n": 20
}Expected Output:
[ 2, 3, 5, 7, 11, 13, 17, 19 ]
+1 more sample test cases (will be validated when you run code)
Sign in to save your progress and mark problems as solved.
Code Editor
Loading editor...
Problem discussion
(0)Join the discussion — login to comment and help other developers.
Login to comment