Capgemini interview question

Perfect number in given range coding round