As of May 4 2007 the scripts will autodetect your timezone settings. Nothing here has to be changed, but there are a few things

Please follow this blog

Search this blog

Saturday, June 21, 2008

Programming Mathematica: Finding Perfect Numbers

Find all numbers less than or equal to 10000 which are equal to the sum of their proper positive divisors. These are the so called Perfect Numbers. For example 6 has proper positive divisors 1,2 and 3 ( 1+2+3=6 ).

Finding a solution to this problem can be done with the following Mathematica program.

PerfectQ [n_]:=Apply[Plus,Divisors[n]]== 2n
PerfectSearch[n_]:=Select[Range [n],PerfectQ]
PerfectSearch[10000]

{6,28,496,8128}


See also: An Introduction to Programming with Mathematica

No comments:

Post a Comment

Popular Posts

Welcome to The Bridge

Mathematics: is it the fabric of MEST?
This is my voyage
My continuous mission
To uncover hidden structures
To create new theorems and proofs
To boldly go where no man has gone before




(Raumpatrouille – Die phantastischen Abenteuer des Raumschiffes Orion, colloquially aka Raumpatrouille Orion was the first German science fiction television series. Its seven episodes were broadcast by ARD beginning September 17, 1966. The series has since acquired cult status in Germany. Broadcast six years before Star Trek first aired in West Germany (in 1972), it became a huge success.)