M = 3
N = 16

prime = [True] * (N + 1)
prime[0] = prime[1] = False

for i in range(2, int(N ** 0.5) + 1):
    if prime[i]:
        for j in range(i * i, N + 1, i):
            prime[j] = False

for i in range(M, N + 1):
    if prime[i]:
        print(i, end=' ')

Embed on website

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