Capgemini Interview Question

Perfect number in given range coding round