A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number, because 6 = 3 + 2 + 1, and the next is 28 = 14 + 7 + 4 + 2 + 1. There are four perfect numbers that are less than 10,000. Write a program to find these four numbers.

Computer Bits Daily
2 min readMay 22, 2023

In number theory, a positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number, because 6 = 3 + 2 + 1, and the next is 28 = 14 + 7 + 4 + 2 + 1. There are only four perfect numbers that are less than 10,000. In this blog post, we will write a Python program to find these four numbers.

Python Program to Find Four perfect Numbers
Table of Contents [ Python Program Perfect Numbers ]
What are perfect numbers?
How to find perfect numbers?
Writing a program to find perfect numbers.
| Learn Python with “ Computer Courses — All in One “
What are perfect numbers?
A perfect number is a positive integer that is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is a perfect number because its divisors are 1, 2, and 3, and 1 + 2 + 3 = 6.

How to find perfect numbers?
To find perfect numbers, we need to check each positive integer to see if it is equal to the sum of its positive divisors. This can be done by iterating over all the integers from 1 to n and checking if each integer is a divisor of n. If it is, we add it to a running total. If the running total equals n at the end of the loop, then n is a perfect number.

https://play.google.com/store/apps/details?id=com.computerdictionary.mcqtutorial.computerbitspradip

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Computer Bits Daily
Computer Bits Daily

Written by Computer Bits Daily

Learning Computer skills and Computer technology by learning and sharing

No responses yet

Write a response