AMD interview question

logic for prime number