Logic Building
# Take number
num = int(input("Enter a number: "))
# Find sum of proper divisors
divisor_sum = 0
for i in range(1, num):
if num % i == 0:
divisor_sum += i
# Check abundant
if divisor_sum > num:
print("Abundant number")
else:
print("Not an abundant number")Output
Enter a number: 12 Abundant number
Sum of proper divisors > number.
Key Concepts:
- Find all proper divisors
- Sum them
- Compare with number