Apple interview question

Derive prime numbers efficiently