Home arrow Projects arrow Other Projects arrow Perfect Numbers
Perfect Numbers Print E-mail
Monday, 27 March 2006
ImageAt work, we have this tradition of inviting your co-workers for a piece of cake when it's your birthday. In such an e-mail invitation, the birthday boy's or girl's age is often cryptically described. One such descriptions was: "last year my age was perfect". After remembering what was so special about perfect numbers, I wrote this little piece of software (many years ago). Perfect numbers are closely related to Mersenne primes.

Read more about those primes on Wikipedia. You'll notice that finding large perfect numbers takes a lot of computing power.

This program determines whether or not a range contains perfect numbers. A number is perfect if the sum of its divisors, not including the number itself, is that number. Examples of perfect numers are 6 (= 1 + 2 + 3) and 28 (= 14 + 7 + 4 + 2 + 1). All perfect numbers can be written as: 2n-1·(2n-1). But not all values of n yield a perfect number. n must be a prime number (this is a simple check), and 2n-1 must be a prime number as well (considerably more time consuming check). The value of n can be entered in the 'From' and 'To' fields.

Exiting the program before completion will save the current state such that calculation will continue where it left off the next time you run the program. When you minimize the program, only idle CPU time will be used. This allow you to run the program in the background without disturbing your normal work.

Image

The additional files:

  • When done, you'll find a results.log in the directory of the executable. It contains a list of all values of n that have been tried. If successful, the perfect number is present as well.
  • times.log contains some profiling info about the amount of time spent in specific parts of the programming routines. Not very interesting.
  • When you quit the program before it's done, a file called per.ser will de written in the directory of the executable. This file allows the calculation to continue when the program is started another time.

This program was never finished properly, so:

  • The logging window does not work properly. Instead of cummulatively displaying data, it only displays the last message.
  • The estimated finish and calculation times where never implemented.

Please also note: This program was never intended as a quick way of finding perfect numbers. It was just a personal experiment writing a program capable of handling very large numbers.

The program can be downloaded from the download section of this site. It runs on Windows (95 and above) systems. The source code is also  available for those interested (written in C). No effort has been made, though, to made it particularly understandable.

Only registered users can write comments.
Please login or register.

 

Last Updated ( Monday, 18 December 2006 )
 
< Prev
2006 Vangilz.com. All Rights Reserved.