Perfect Numbers 
Author Message
 Perfect Numbers


Quote:
> While reading Simon Singh's book, "Fermat's Last Theorem", I got
> the urge to try and code some of the ideas in Forth. Hopefully
> somebody will find it amusing.

Unfortunately, Mr. Singh was not completely accurate in his description
of Perfect Numbers (or maybe I didn't read the text carefully enough).

In my program I used that Euclid found that perfect numbers are always
a multiple of two numbers n1 and n2, n1 a power of two, n2 the next power
of 2 minus 1:

      6 = 2^1 * (2^2 - 1)
     28 = 2^2 * (2^3 - 1)
    496 = 2^4 * (2^5 - 1)
  8,128 = 2^6 * (2^7 - 1)

What the book didn't say is that in addition Euclid found that when n2
is prime, n automatically is a perfect number. This opens the door to
finding much larger Perfect Numbers, because [probability] algorithms
exist that can test if a number is prime.

I've written a Forth program that will check that, e.g., 2^3217 - 1 is
prime and prints out the accompanying Perfect Number. For the given number
the check takes only a few seconds on a P54C-166. (I can't show these numbers
as my news reader thinks I'm trying to post a binary in a non-binary group).

The program can be found on http://www.*-*-*.com/

-marcel



Thu, 11 Sep 2003 09:57:48 GMT  
 Perfect Numbers

Quote:

  ...

> The program can be found on ttp://www.iaehv.nl/users/mhx/programs.html

> -marcel

Wow! I stand in awe! Beautiful, simple, comprehensive. In fact, sublime.

Jerry
--
Engineering is the art of making what you want from things you can get.
-----------------------------------------------------------------------



Fri, 12 Sep 2003 01:41:53 GMT  
 Perfect Numbers
 These prime numbers are called Mersenne's prime take a look at
http://www.mersenne.org/prime.htm

Jeff



Quote:

> > While reading Simon Singh's book, "Fermat's Last Theorem", I got
> > the urge to try and code some of the ideas in Forth. Hopefully
> > somebody will find it amusing.

> Unfortunately, Mr. Singh was not completely accurate in his description
> of Perfect Numbers (or maybe I didn't read the text carefully enough).

> In my program I used that Euclid found that perfect numbers are always
> a multiple of two numbers n1 and n2, n1 a power of two, n2 the next power
> of 2 minus 1:

>       6 = 2^1 * (2^2 - 1)
>      28 = 2^2 * (2^3 - 1)
>     496 = 2^4 * (2^5 - 1)
>   8,128 = 2^6 * (2^7 - 1)

> What the book didn't say is that in addition Euclid found that when n2
> is prime, n automatically is a perfect number. This opens the door to
> finding much larger Perfect Numbers, because [probability] algorithms
> exist that can test if a number is prime.

> I've written a Forth program that will check that, e.g., 2^3217 - 1 is
> prime and prints out the accompanying Perfect Number. For the given number
> the check takes only a few seconds on a P54C-166. (I can't show these
numbers
> as my news reader thinks I'm trying to post a binary in a non-binary
group).

> The program can be found on http://www.iaehv.nl/users/mhx/programs.html .

> -marcel



Sat, 13 Sep 2003 19:31:20 GMT  
 Perfect Numbers


Quote:
>> I've written a Forth program that will check that, e.g., 2^3217 - 1 is
>> prime and prints out the accompanying Perfect Number. For the given number
>> the check takes only a few seconds on a P54C-166. (I can't show these
>numbers
>> as my news reader thinks I'm trying to post a binary in a non-binary
>group).

When your newsreader thinks that this number is binary even if it is
composed of ASCII characters, then it must really be a PERFECT number.
:-)))
Andreas


Sat, 13 Sep 2003 21:41:30 GMT  
 Perfect Numbers

Quote:
> These prime numbers are called Mersenne's prime take a look at
> http://www.mersenne.org/prime.htm

Thanks. Both the original posting and the program sources mention
this and, of course, use a table of Mersenne Primes. The point of
the Perfect Number play is just to exercise the bignumber package
I wrote 10 years ago (under direction of Albert van der Horst), and
test the RABIN? procedure (It had a bug, but at least I had no
problem at all reading the code :-)

-marcel



Sun, 14 Sep 2003 02:14:33 GMT  
 Perfect Numbers

Quote:
>> I've written a Forth program that will check that, e.g., 2^3217 - 1 is
>> prime and prints out the accompanying Perfect Number. For the given number
>> the check takes only a few seconds on a P54C-166. (I can't show these numbers
>> as my news reader thinks I'm trying to post a binary in a non-binary group).
> When your newsreader thinks that this number is binary even if it is
> composed of ASCII characters, then it must really be a PERFECT number.
> :-)))

Try posting a very long string of characters and digits. Decent reader
software will assume that you are trying to post a hex-encoded file.
Really decent software will probably let you overrule it, but this
one double-checked its arguments, counted its options, calculated
the risks and made the wrong decision :-)

-marcel



Sun, 14 Sep 2003 02:15:16 GMT  
 Perfect Numbers


Quote:

> > These prime numbers are called Mersenne's prime take a look at
> > http://www.mersenne.org/prime.htm

> Thanks. Both the original posting and the program sources mention
> this and, of course, use a table of Mersenne Primes. The point of
> the Perfect Number play is just to exercise the bignumber package
> I wrote 10 years ago (under direction of Albert van der Horst), and
> test the RABIN? procedure (It had a bug, but at least I had no
> problem at all reading the code :-)

> -marcel

Sorry I've not read enough ... . But for mersenne' numbers the interesting
thing was that there exist a specific test for there
primality,  the Lucas-Lehmer test. But perhaps you already know that .


Sun, 14 Sep 2003 06:53:16 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. New user need help with perfect numbers.

2. Perfect Numbers

3. ASM to test Perfect Number

4. Finding perfect numbers

5. Perfect Number

6. Perfect Numbers, Complexity

7. Yet another perfect number program

8. Yet another perfect number program

9. perfect numbers

10. Numbers Numbers Numbers

11. Perfect example of why subclassing can be dangerous...

12. Golf - The perfect problem to compare languages with?

 

 
Powered by phpBB® Forum Software