Hi everyone.

I often encounter the same problem over and over again when
demonstrating the prime program.
People regularly ask me: what is this program doing?
After I've explained to them what the LL-test does (and if they're still
with me after that :) they ask me why it's not showing the Lucas-number
at each step? (Actually they simply call it "the Number".)
I then reply: well, the number is rather big. It wouldn't even fit onto
the screen. (To give you a better idea, the complete number would fill,
what, 400 screens or something?) The program _can_ show the last couple
of digits, but for some reason it doesn't want to do that at each
iteration, it only does so when it's finished.
So they ask: why not? That way we could see what it's doing. Or is it a
secret?
I tell them no, but some seem to be unconvinced. Maybe they reckon: If
it wasn't a secret, the program would show it, right?

The program output during a Lucas-Lehmer test currently gives no
mathematical insight whatsoever into what the computer is doing.

A lot of schools use the program to explain about divisibility and prime
numbers.
It would help if it would show us the LL-test.
They could actually see, that when they enter a small prime, say 7, the
program would show the Lucas sequence for M(7) (=2^7-1=127):
4
14
67
42
111
0

They could then (or before) do the same test by hand:
Iteration 1: 4 (starting value of LL-test)
Iteration 2: (4^2-2)   mod 127 = 14  mod 127 = 14
Iteration 3: (14^2-2)  mod 127 = 194 mod 127 = 67
Iteration 4: (67^2-2)  mod 127 = 42
Iteration 5: (42^2-2)  mod 127 = 111
Iteration 6: (111^2-2) mod 127 = 0
So the last number in the Lucas sequence of M(7) is zero. Therefore, the
LL-test says that 127 is a prime number.
And as we all know, that is correct.
Conversely, a non-zero end result would tell us that the Mersenne number
is composite.

That's enough elementary school for now.

Here's another reason: the big number freaks could show off this
"proggie" to their geek friends, letting the big numbers go flashing by
on their 21" screens. <Yeah, them numbers is actual data, the whole
thing's a whopping 10Megadigits. Cool, huh?> ;-)
But seriously folks, the program need no longer be a black box where a
number goes in, you get to wait x months, and a number comes out.
Instead, it can show that it is really calculating!

OK, so what's the user interface:
  ----------------------------------------
  Show Number
  Show me the last few digits of the
  current Lucas number at each iteration.
  Number of digits to display (1-100): 16

  Representation
  (What kind of digits do you want to see)
  * hexadecimal (h)
    decimal     (d)
    binary      (b)

  [OK]     [Cancel]
  ----------------------------------------
When you click on 'OK', the program sets a check mark in front of the
Options menu item 'Show Number'.

In default display mode, you'll see lines like:
Iteration: 33219300/33219379 [99.99%]. Per iteration time: ....(etc)
You may have seen lines beginning with 'Iteration:' before. :)
In 'Lucas' display mode, the program would instead show the last part of
the Lucas number at every iteration.


For calculating the decimal expansion, I would suggest the following
coding compromise in order to minimize CPU overhead:
Let the program read only the last 50 bytes of the Lucas number L[k],
expand it to decimal form, and display the last n decimal digits
thereof.
So b =  L[k] mod  2^n,
   h =  L[k] mod (2^( 4*n))       and
   d = (L[k] mod (2^(50*8))) mod 10^n.
where n is the number of digits to be displayed.
The readme.txt should of course contain a note about the program reading
only the last 50 bytes of the L-number.

Now notice that when a LL-test begins, you'll see (in decimal mode):
4
14
194
37634
1416317954
etc.
That is, the Lucas sequence!

If you have the program set on (at least) 16 hex digits when you get to
the last few iterations, you'll see that the residue is the same!

During the LL test, you might even spot any periodicity occurring ;-)


Any comments on this proposal?

Robert van der Peijl <[EMAIL PROTECTED]>

_________________________________________________________________
Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ      -- http://www.tasam.com/~lrwiman/FAQ-mers

Reply via email to