CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    5

    PERFECT NUMBERS ???

    Hi,

    Define "Perfect number".
    give examples.

    Dini.


  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: PERFECT NUMBERS ???

    A perfect number is a number whose sum of
    all of its divisors (except for the number) is
    equal to the number itself.

    Example: 6 = (1+2+3).

    I leave it as an exercise for you to come up with
    the next 3.

    Regards,

    Paul McKenzie


  3. #3
    Join Date
    Apr 1999
    Location
    WA, USA
    Posts
    15

    Re: PERFECT NUMBERS ???

    the generic formula for a perfect number is as below:
    every number of type (2 power n)*((2 power (n+1) - 1) is a perfect number if
    ((2 power (n+1) - 1).


    Let us say :
    T1 = 2 power n
    T2 = 2 power (n+1) - 1

    i.e T1 = 2 * 2 * 2 * ........ n times.
    and T2 = T1 * 2 -1


    if T2 is a prime number, then product of T1 and T2 is a perfect number.

    Examples of T2 to be prime numebers


    n = 1, T2 = 3 prime => 2*3 = 6 is a perfect number.
    n=2 , T2 = 7 prime => 4*7 = 28 is a perfect number.
    n=4, T2= 31 prime => 16*31 = 496 is a perfect number.
    where as
    n=3, T2 = 15 in not a prime => 8*15 is not a perfect number.








Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured