Domanda di colloquio di Infosys

Write code for prime number is optimized way?