A positive integer n is abundant when its aliquot sum (sum of proper divisors) is strictly greater thann. The difference aliquotSum − n is called the abundance.
Remember
aliquotSum = sum of proper divisors of n
aliquotSum > n → abundant
abundance = aliquotSum − n
Proper divisors = positive divisors of n, except n itself
Example: 12 → 1+2+3+4+6 = 16 > 12 → abundant (abundance 4)
Class
Condition
Example
Deficient
divSum < n
7 → 1 < 7
Perfect
divSum == n
6 → 1+2+3 = 6
Abundant
divSum > n
12 → 1+2+3+4+6 = 16
First abundant numbers (1–50)
Handy checklist for interviews and unit tests — the first value must be 12.
List
12, 18, 20, 24, 30, 36, 40, 42, 48
Approach
How to Check an Abundant Number in C#
Four clear steps — then pick a basic or O(√n) loop.
Reject n <= 1.
Sum proper divisors (aliquot sum).
Compare with n using strict >.
Optionally report abundance sum − n or classify deficient / perfect / abundant.
Method
Idea
Time
Best for
Basic loop
Add every divisor from 1 to n / 2
O(n)
Interviews, small n
Divisor pairs
Loop to √n; add i and n / i (skip n)
O(√n)
Larger n, optimizations
Pseudocode
Pseudocode
function IsAbundant(n):
if n <= 1:
return false
divSum = 0
for i from 1 to floor(n / 2):
if n mod i == 0:
divSum = divSum + i
return divSum > n
Try it
Live Preview
Enter any positive integer to see proper divisors, sum, and classification.
Whole numbers n ≥ 1 (capped at 999999). Tap a chip or type a value.
Result
n = 12
Proper divisors (aliquot parts): 1, 2, 3, 4, 6
Aliquot sum = 16
Abundance = 16 − 12 = 4
Compare: 16 > 12
Verdict: ABUNDANT
Trace
Worked Walkthrough — n = 12
Check values from 1 through 6. Only 5 does not divide 12 evenly.
Start with the readable O(n) solution. Then use divisor pairs for an O(√n) interview optimization.
Example 1 — Check One Number
Sum proper divisors with a loop to n / 2, then return divSum > n.
C#
using System;
class Program
{
static bool IsAbundant(int num)
{
if (num <= 1)
{
return false;
}
int divSum = 0;
for (int i = 1; i <= num / 2; i++)
{
if (num % i == 0)
{
divSum += i;
}
}
return divSum > num;
}
static void Main()
{
int number = 12;
if (IsAbundant(number))
{
Console.WriteLine(number + " is an abundant number.");
}
else
{
Console.WriteLine(number + " is not an abundant number.");
}
}
}
Output
12 is an abundant number.
How it works: no proper divisor exceeds num / 2. Add each value that divides evenly, then return whether the sum is greater than num.
Example 2 — O(√n) with Divisor Pairs
For each factor i, also consider n / i — never add n, and do not double-count squares.
C#
using System;
class Program
{
static bool IsAbundantFast(int num)
{
if (num <= 1)
{
return false;
}
int divSum = 1; // 1 is always a proper divisor for num > 1
for (int i = 2; i <= num / i; i++)
{
if (num % i == 0)
{
divSum += i;
int partner = num / i;
if (partner != i && partner != num)
{
divSum += partner;
}
}
}
return divSum > num;
}
static void Main()
{
Console.WriteLine(IsAbundantFast(12)); // True (abundant)
Console.WriteLine(IsAbundantFast(28)); // False (perfect)
}
}
Output
True
False
How it works: each divisor i has a partner num / i. Add both once, stopping at √n. The condition i <= num / i also avoids integer overflow.
Edge Cases & Pitfalls
Check these before calling the solution done.
n <= 1
Not abundant
Return false before any loop.
Include n?
Never add n
Including n wrongly makes almost every number look abundant.
>= vs >
Use strict >
>= wrongly labels perfect numbers (6, 28) as abundant.
Squares
No double-count
In pair mode, add the partner only when partner != i.
Analysis
Time and Space Complexity
Program
Time
Extra space
Basic loop to n/2
O(n)
O(1)
Divisor pairs up to √n
O(√n)
O(1)
Remember
Key Takeaways
Definition: aliquot sum > n; abundance = sum − n.
Exclude n: proper divisors never include the number itself.
Two loops: basic 1 … n/2, or pairs up to √n.
Test set: 12 true; 6 and 28 false; any prime false.
One line: compute the aliquot sum; if it exceeds n, the number is abundant (abundance = sum − n).
Frequently Asked Questions
A positive integer is abundant when the sum of its proper divisors is greater than the number. For 12, the proper divisors total 16, so 12 is abundant.
Sum every proper divisor of n, then test whether the sum is greater than n. A simple loop checks 1 through n/2; an optimized loop checks divisor pairs through √n.
Compare the proper-divisor sum with n. A smaller sum is deficient, an equal sum is perfect, and a larger sum is abundant.
No. The number 1 has no positive proper divisors, and a prime has only 1 as a proper divisor. Their sums cannot exceed the original number.
The basic loop is O(n). The divisor-pair method is O(√n). Both use O(1) extra space.