Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
perfect numbers...
Author Message
Prince

Posted: Thu Feb 12, 2004 10:33 am   Post subject: perfect numbers...

i kno this is easy (mayb its jus my laziness) does sumone kno of a simple way to find perfect numbers?

Tony

Posted: Thu Feb 12, 2004 10:36 am   Post subject: (No subject)

what's the definition of a perfect number?
Tony's programming blog. DWITE - a programming contest.
Prince

Posted: Thu Feb 12, 2004 10:40 am   Post subject: (No subject)

a number thats equal to the sum of its proper factors is a perfect number
Tony

Posted: Thu Feb 12, 2004 10:42 am   Post subject: (No subject)

hmm... forloop factors and see if they make up a perfect number
Tony's programming blog. DWITE - a programming contest.
Prince

Posted: Thu Feb 12, 2004 10:59 am   Post subject: (No subject)

lol umm could u explain that a bit
Tony

Posted: Thu Feb 12, 2004 2:25 pm   Post subject: (No subject)

well I'm not too sure on the "proper factors" part... but assuming that any number can be a proper factor and you'll looking at numbers up to 100 assuming each has 2 factors only.
 code: for(i = 1; i<11;i++) {      for(i2 = 1; i2<11;i2++)      {           if (i*i2) == (i+i2) then           { System.out.println(i+i2 + " is a perfect number); }      } }

Thought I donno... it seems that there got to be a better way out there...
Tony's programming blog. DWITE - a programming contest.
wtd

Posted: Thu Feb 12, 2004 3:17 pm   Post subject: (No subject)

http://mathforum.org/dr.math/faq/faq.perfect.html

And quickly, the Quick BASIC program in the above page for finding Mersenne primes and their associated perfect numbers:

 code: DEFDBL A-Y: DEFSTR Z: CLS   mer = 1: two# = 1: power = 1: xm = y: x2 = y 1 power = power + 1: mer = mer + mer + 1: two# = two# + two#   LOCATE 25, 1: PRINT "Testing"; mer;   FOR i = 3 TO INT(SQR(mer + 1)) STEP 2: IF (mer MOD i) = 0 THEN 1   NEXT   LOCATE 24, 1: PRINT USING "#,###########"; mer;   PRINT " = 2^"; LTRIM\$(STR\$(power)); "-1";   IF power < 31 THEN       PRINT TAB(36); USING "###,###########"; two# * mer;     ELSE PRINT TAB(26); "2,305,843,008,139,952,128";   END IF   PRINT " = (2^"; LTRIM\$(STR\$(power)); "-1) * 2^"; LTRIM\$(STR\$(power - 1))   IF power < 31 THEN 1
Cervantes

Posted: Thu Feb 12, 2004 5:10 pm   Post subject: (No subject)

um, anyways... google prime numbers you'll find a bunch of stuff.
its something like 2(n^2) (2n^2) where (2n^2) is a prime... dunno, kinda confusing.. google it though, you'll find a much better explanation
MysticVegeta

Posted: Fri May 06, 2005 5:56 pm   Post subject: (No subject)

Tony wrote:
well I'm not too sure on the "proper factors" part

Yes they are only proper factors.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 9 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: