- 1.
- For a positive integer
*M*define the following transformation. Write*M*as a binary number, then read the resulting sequence of 1s and in the opposite direction, and take the decimal number with that binary representation for the result of our operation. For instance, take decimal*M*= 25 = "11001". Then its binary represenation "11001" read the other way is "10011" = 19, so we have .Print out the results of this operation for

Here is how the output begins: .

- 2.
- A positive integer is called
*perfect*if the sum of all its divisors (including 1 but exluding the number itself) is equal to that number. Input a positive integer*M*and print out all perfect numbers less than*M*.Example: The first two perfect numbers are 6 ( 6 = 1 +2 +3) and 28 ( 28 = 1 + 2 + 4 + 7 + 14 ). Perfect numbers are rare -- there are no other perfect numbers less than 100 and only one more less that 1000.