Abundant Numbers

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]



Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only



Problem Description

What is largest integer which cannot be expressed as the sum of two abundant numbers?

Background & Techniques

 A number, the sum of whose proper divisors is equal to the number itself, is called a perfect number. If the
sum is less than the number, the number is deficient and if the sum is greater, it is abundant. (Proper divisors are divisors which a smaller than the number itself.)

It has been proven that every number greater than 83,160 can be expressed as the sum of two abundant
numbers. This program  answers a few  questions about the number of abundant numbers and the sums which they can (and can't) form:

  • What is the distribution of number types (deficient, perfect, abundant) for integers up to 1,000,000?
  • What is the smallest odd abundant number?
  • Some numbers less than 83,160 cannot be expressed as the sum of two abundants.. What is the largest number which cannot be expressed as the sum of two abundant numbers? What is the smallest that can be?
  • So, just how many numbers are there which cannot be expressed as the sum of two abundant numbers?

Non-programmers are welcome to read on, but may want to skip to the bottom of this page to download executable version of the program.

A few "helper" functions:

  • Checktype returns a TNbrType for a passed integer where TNbrtype is defined as (deficient, perfect, abundant).:
  • BuildAbundants returns a sparse table of Boolean flags up to the passed maximum value Max.   The table has "Max" Boolean entries filled false for non-abundant and True for abundant numbers.   This allows rapid  checks of whether a specific number is abundant.   
  • MakeFactorsString returns a string of form  "a + b + c +.... = N"  where {a,b,c ...} are the proper factors of N. 

Two programming notes in case you haven't already added them to your bag of tricks:

Dynamic arrays passed as parameters can only have their length reassigned if the type is a predefined array type.  In other words, this works:

    TBoolArray=array of boolean;
procedure makeAbundants(var a:TBoolArray; const Max:integer);
    setlength(a,max+1); .....

var  a:TBoolArray;  ....

But this does not

procedure makeAbundants(var a: array of Boolean; const Max:integer);
    setlength(a,max+1);    ....

var  a:array of Boolean; ......
       MakeAbundants(a,83160); ....

Also, there is no formatting string entry  which will embed "thousand separator" for integers, i.e. commas for U.S.  The best solution I have found  looks like uses the "%n" format and requires that the integer be converted to a floating point value like this:   add( format ('Deficient count: %.0n',[0.0+d]));


Running/Exploring the Program 

Suggestions for Further Explorations

Would summing 3 abundant numbers change the statistics? 

Sums for a particular number can often be formed in more than 1 way.   Does number of ways increase with the size of the number?   




Original Date: February 10, 2008 

Modified: February 18, 2016



  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2016, Gary Darby    All rights reserved.