on python

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

on python

Post by correctanswer »

On Python 1
On Python 1 (185.87 KiB) Viewed 72 times
on python
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]
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply