Question: Write a Python program to print all Perfect numbers between 1 to n. (Use any loop you want) Perfect number is a positive integer which

  1. Write a Python program to print all Perfect numbers between 1 to n. (Use any loop you want)

Perfect number is a positive integer which is equal to the sum of its proper positive divisors.

Proper divisors of 6 are 1, 2, 3.

Sum of its proper divisors = 1 + 2 + 3 = 6.

Hence 6 is a perfect number.

*** proper divisor means the remainder will be 0 when divided by that number.

Sample Input: n = 1000;

Sample Output: 6, 28, 496

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!