At 04:29 PM 9/1/99 -0300, you wrote:

>       Of course it is. Not only 127 is prime, but also 
>127=1+2+4+8+16+32+64. Knuth lovers may like to know that
>numbers in the form 111111...1111b can only be prime if
>the number of digits is prime too (demonstration left to 
>the reader).

:)


Well, I'm a reader, so here comes a demonstation:

Number N has D digits, which are all ones.

Assume D is not a prime number.
So there are numbers A and B such that A*B=D (A>1,B>1).

Now make numbers C[X], where C[X] is B ones followed by B*X zeroes.
For every X, the numbers C[X] are dividable by the number "B ones".

The sum of C[0]..C[A-1] is N.
So N is also dividable by the number "B ones".
Since B>1, "B ones" is also greater than 1, so N is not prime.


Example:

N = 255 = 11111111b (8 ones)
8=4*2 (choice 2*4 is also possible)

C[0] =       11b
C[1] =     1100b
C[2] =   110000b
C[3] = 11000000b
sum  = 11111111b = 255 = N

C[0]..C[3] are dividable by 11b (3), so the sum is too. And that sum is N,
so N is dividable by 3 and therefore not prime.


By the way, the inverse is not always true: If the number of binary digits
is prime, is the number itself is not guaranteed to be prime. Example: 2047.

Bye,
                Maarten


****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****

Reply via email to