N = 50
arr = [True] * N
arr[0], arr[1] = False, False

for x in range(2, int(N ** 0.5) + 1):
    sum = x
    while sum + x < N:
        sum += x
        arr[sum] = False

for x in range(N):
    if arr[x] == True:
        print(x)
        

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: