Apple Interview Question

Derive prime numbers efficiently