DEV Community

ETHAN LEONG _
ETHAN LEONG _

Posted on

1

Prime Function

def get_primes(n):
primes = []
candidate = 2
while len(primes) < n:
for p in primes:
if candidate % p == 0:
break
else:
primes.append(candidate)
candidate += 1
return primes

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

If you found this post helpful, please leave a ❤️ or a friendly comment below!

Okay