Katkat

Implement Function to Return First n Prime Numbers

PinterestData Scientist · Onsite

Last updated

This question evaluates algorithmic problem-solving and basic number-theory competency by requiring generation of prime numbers with attention to correctness and performance characteristics.

Scenario

Quick algorithm screen to gauge Python fluency.

Question

Implement a Python function that returns the first n prime numbers.

Hints

An optimized sieve or trial-division with memoization keeps it simple and efficient.