on python
Posted: Fri Jun 10, 2022 11:56 am
Question 4 (25 pts): Write a function (has the name of divisorsOfNumber) that takes an integer input as its argument and collects all divisors of this integer as a list. Thereafter, write another function (has the name of perfectNumbers) that takes given integer as an argument and uses the function of divisorsOfNumber to return a list that has all Perfect numbers until the given integer. Definition: Perfect number is a positive integer that is equal to the sum of its proper divisors, excluding the number itself. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers are 28, 496, and 8128. Example output for given input as 10000: [1, 2, 4, 5, 8, 10, 16, 20, 25, 40, 50, 80, 100, 125, 200, 250, 400, 500, 625, 1000, 1250, 2000, 2500, 5000] [6, 28, 496, 8128]