Abundant Numbers

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

 

Search

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.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

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:

bulletWhat is the distribution of number types (deficient, perfect, abundant) for integers up to 1,000,000?
bulletWhat is the smallest odd abundant number?
bulletSome 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?
bulletSo, 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:

bulletChecktype returns a TNbrType for a passed integer where TNbrtype is defined as (deficient, perfect, abundant).:
bulletBuildAbundants 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.   
bulletMakeFactorsString 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:

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

var  a:TBoolArray;  ....
Begin
       MakeAbundants(a,83160);...

But this does not

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

var  a:array of Boolean; ......
Begin
       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 

bullet Download source
bullet Download  executable

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: July 29, 2017

 

 

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