Abundant Numbers
Find abundant numbers (sum of proper divisors > number).
AdvancedPhase 6 - Category 1: Number LogicExample 9 of 10
abundant-numbers.py
1# Find abundant numbers2print("Abundant numbers 1-100:")34for num in range(1, 101):5 divisor_sum = 06 for i in range(1, num):7 if num % i == 0:8 divisor_sum += i910 if divisor_sum > num:11 print(num, end=" ")12print()
Output
Abundant numbers 1-100: 12 18 20 24 30 36 40 42 48 54 ...
What's going on
Check if sum of proper divisors exceeds number.
Key Concepts:
Find all proper divisors
Sum them
Compare with number
🔗Related Content
- 📖
Phase 6 - Learn Concepts
Review Phase 6 concepts and explanations
- 📝
Phase 6 - Quiz
Test your Phase 6 understanding with quiz questions
- 💻
Phase 6 - All Practice Problems
Explore all practice problems for Phase 6
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum