# 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?

# Smart algorithm for finding perfect numbers

Is there an algorithm that is quicker than O(N^2) for finding perfect numbers from a sample 1:N? Or any general speed improvements to do less computation? I know we can remove odd numbers from the sample if we assume they are not perfect (unproven but we can assume it here regardless). >Solution : Here is… Read More Smart algorithm for finding perfect numbers

# How to find if a number is perfect number with a recursive code

So I want to write a func which get a number and return True if it a "perfect number". I need to do it without using for or while in my function. Here is what I tried to do – def question_1(num): i = 1 def checkDivide(n, num): if num % n == 0: return… Read More How to find if a number is perfect number with a recursive code

# 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?