Pregunta de entrevista de Nasdaq

Technical question on finding prime numbers