Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Find all prime numbers in a range using the Sieve of Eratosthenes.

Hard

Problem Statement

Find all prime numbers in a range using the Sieve of Eratosthenes.

Sample Input

50

Sample Output

[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
def sieve_of_eratosthenes(): n = 50 # Your code here return
Log in or sign up to run or submit your code.Log inSign up
Input
50
Expected Output
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]