Why is this algorithm in Python is printing the result several times?

This algorithm, which is attached and written below, is printing the result multiple times. It is an algorithm to find out if the received number is a perfect number, that is, if the sum of the divisors of that number results in the number itself, then it is a perfect number. Example: the divisors of… Read More Why is this algorithm in Python is printing the result several times?

How would I print out the perfect numbers along with their divisors shown next to them in python?

#I have the formula in which the code produces all perfect numbers between 1 and 10,000 and I want the divisors printed out alongside the perfect numbers n = 1 while n <= 10001: sum = 0 divisor = 1 while divisor < n: if not n % divisor: sum += divisor divisor = divisor… Read More How would I print out the perfect numbers along with their divisors shown next to them in python?