Thread: Perfect Number - faster Algo Pls..

  1. #16
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    A neater (imo) way of writing that formula is

    x = ((2 ^ n) - 1)(2 ^ (n - 1))

    But that is only going to hit the even perfect numbers. There still might be odd perfect numbers out there. Nobody knows. Brute force checking has shown there are no odd perfect numbers that fit in 64 bits. But relying on this previously-done brute force checking would be just as bad as writing the known perfect numbers out directly in code, no? ;-)

  2. #17
    EOF
    Join Date
    Aug 2005
    Location
    Constanta, RO, Europe
    Posts
    46
    this is a thing i don't get. they say euler has shown that the rule is valable for any perfect, respectively marsenne. and yet they say there might be even perfects... can anyone throw a light upon this?

    EDIT: oh, and about the minimum size of that odd number, by the time i write this, it has more than 300 digits.
    Last edited by moonlord; 08-21-2005 at 07:53 AM.
    Two strings walk into a bar. The first one says, 'Bartender! Bartender! I want a drink!'. The second one says, 'Bartender! Bartender! I want a drink too! Blaaaaaaaaah eeeeeeeek yaaaaaaak oooooooh'. The first one says, 'Please excuse my friend. He isn't null term--'.

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    they say euler has shown that the rule is valable for any perfect, respectively marsenne. and yet they say there might be even perfects... can anyone throw a light upon this?
    Um, all known perfect numbers are even. Euler's proof applies to all even perfect numbers.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #19
    EOF
    Join Date
    Aug 2005
    Location
    Constanta, RO, Europe
    Posts
    46
    oh, sorry, i always confuse these. so, even is when x%2==0 and odd when x%2==1? then you must read my post the other way
    Two strings walk into a bar. The first one says, 'Bartender! Bartender! I want a drink!'. The second one says, 'Bartender! Bartender! I want a drink too! Blaaaaaaaaah eeeeeeeek yaaaaaaak oooooooh'. The first one says, 'Please excuse my friend. He isn't null term--'.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program giving errors
    By andy bee in forum C Programming
    Replies: 5
    Last Post: 08-11-2010, 10:38 PM
  2. Number system base M, print numbers N digits wide...
    By biterman in forum C Programming
    Replies: 12
    Last Post: 11-19-2001, 04:31 AM
  3. Perfect number
    By TheSki in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2001, 04:34 PM
  4. Perfect Numbers - Need Help
    By cstraw in forum C++ Programming
    Replies: 5
    Last Post: 10-28-2001, 05:28 PM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM