WWV (radio station): Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Monkbot
en>Jeh
m Undid revision 639504916 by 71.40.66.188 (talk) restore removed detail; rm "of the carrier" as unnecessary - what else would be modulated but the carrier?
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{about|the Lucas–Lehmer test that only applies to Mersenne numbers|the Lucas–Lehmer test that applies to a natural number ''n''|Lucas primality test|the Lucas–Lehmer–Riesel test|Lucas–Lehmer–Riesel test}}
Adrianne Le is the brand my parents gave i but you can connect with me anything you prefer. My house is now all through South Carolina. Filing is my day job now but soon I'll getting on my own. What me and my family completely love is acting but All of us can't make it simple profession really. See what's new on individual website here: http://prometeu.net<br><br>My homepage: [http://prometeu.net clash of clans hack no survey no password]
 
{{tone|date=January 2014}}
In [[mathematics]], the '''Lucas–Lehmer test''' ('''LLT''') is a [[primality test]] for [[Mersenne prime|Mersenne number]]s. The test was originally developed by [[Édouard Lucas]] in 1856,<ref>[http://primes.utm.edu/notes/by_year.html The Largest Known Prime by Year: A Brief History]</ref> and subsequently improved by Lucas in 1878 and [[Derrick Henry Lehmer]] in the 1930s.
 
==The test==
The Lucas–Lehmer test works as follows. Let ''M''<sub>''p''</sub>&nbsp;=&nbsp;2<sup>''p''</sup>&nbsp;&minus;&nbsp;1 be the Mersenne number to test with ''p'' an [[odd prime]] (because ''p'' is exponentially smaller than ''M''<sub>''p''</sub>, we can use a simple algorithm like [[trial division]] for establishing its primality). Define a sequence {''s''<sub>&nbsp;''i''</sub> } for all ''i'' ≥ 0 by
 
:<math>
  s_i=
  \begin{cases}
    4 & \text{if }i=0;
  \\
    s_{i-1}^2-2 & \text{otherwise.}
  \end{cases}
</math>
 
The first few terms of this sequence are 4, 14, 194, 37634, ... {{OEIS|id=A003010}}.
Then ''M''<sub>''p''</sub> is prime iff
:<math>s_{p-2}\equiv0\pmod{M_p}.</math>
The number ''s''<sub>''p''&nbsp;&minus;&nbsp;2</sub>&nbsp;mod&nbsp;''M''<sub>''p''</sub> is called the '''Lucas–Lehmer residue''' of ''p''. (Some authors equivalently set ''s''<sub>1</sub>&nbsp;=&nbsp;4 and test ''s''<sub>''p''&minus;1</sub> mod ''M''<sub>''p''</sub>). In [[pseudocode]], the test might be written:
 
''// Determine if M<sub>''p''</sub> = 2<sup>''p''</sup> &minus; 1 is prime
'''Lucas–Lehmer'''(p)
    '''var''' s = 4
    '''var''' M = 2<sup>''p''</sup> &minus; 1
    '''repeat''' p &minus; 2 times:
        s = ((s &times; s) &minus; 2) mod M
    '''if''' s = 0 '''return''' PRIME '''else''' '''return''' COMPOSITE
 
By performing the <code>mod M</code> at each iteration, we ensure that all intermediate results are at most ''p'' bits (otherwise the number of bits would double each iteration). It is exactly the same strategy employed in [[modular exponentiation]].
 
== Time complexity ==
 
In the algorithm as written above, there are two expensive operations during each iteration: the multiplication <code>s&nbsp;&times;&nbsp;s</code>, and the <code>mod M</code> operation. The <code>mod M</code> operation can be made particularly efficient on standard binary computers by observing the following simple property:
 
:<math>k \equiv (k \hbox{ mod } 2^n) + \lfloor k/2^n \rfloor \pmod{2^n - 1}.</math>
 
In other words, if we take the least significant ''n'' bits of ''k'', and add the remaining bits of ''k'', and then do this repeatedly until at most ''n'' bits remain, we can compute the remainder after dividing ''k'' by the Mersenne number 2<sup>''n''</sup>&minus;1 without using division. For example:
 
{|
|916 mod 2<sup>5</sup>&minus;1 || = || 1110010100<sub>2</sub> mod 2<sup>5</sup>&minus;1
|-
|                              || = || 11100<sub>2</sub> + 10100<sub>2</sub> mod 2<sup>5</sup>&minus;1
|-
|                              || = || 110000<sub>2</sub> mod 2<sup>5</sup>&minus;1
|-
|                              || = || 1<sub>2</sub> + 10000<sub>2</sub> mod 2<sup>5</sup>&minus;1
|-
|                              || = || 10001<sub>2</sub> mod 2<sup>5</sup>&minus;1
|-
|                              || = || 10001<sub>2</sub>
|-
|                              || = || 17.
|}
 
Moreover, since <code>s &times; s</code> will never exceed M<sup>2</sup> < 2<sup>2p</sup>, this simple technique converges in at most 1 ''p''-bit addition (and possibly a carry from the ''p''th bit to the 1st bit), which can be done in linear time. As a small exceptional case, the above algorithm will produce 2<sup>''n''</sup>&minus;1 for a multiple of the modulus, rather than the correct value of zero; this should be accounted for.
 
With the modulus out of the way, the asymptotic complexity of the algorithm depends only on the [[multiplication algorithm]] used to square ''s'' at each step. The simple "grade-school" algorithm for multiplication requires [[big O notation|O]](''p''<sup>2</sup>) bit-level or word-level operations to square a ''p''-bit number, and since we do this O(''p'') times, the total time complexity is O(''p''<sup>3</sup>). A more efficient multiplication method, the [[Schönhage–Strassen algorithm]] based on the [[Fast Fourier transform]], requires O(''p'' log ''p'' log log ''p'') time to square a ''p''-bit number, reducing the complexity to O(''p''<sup>2</sup> log ''p'' log log ''p'') or Õ(''p''<sup>2</sup>).<ref>{{Citation |last=Colquitt |first=W. N. |last2=Welsh |first2=L., Jr. |title=A New Mersenne Prime |journal=Mathematics of Computation |volume=56 |issue=194 |pages=867–870 |year=1991 |quote=The use of the FFT speeds up the asymptotic time for the Lucas–Lehmer test for M<sub>''p''</sub> from O(''p''<sup>3</sup>) to O(''p''<sup>2</sup> log ''p'' log log ''p'') bit operations. }}</ref> Currently the most efficient known multiplication algorithm,  [[Fürer's algorithm]], needs <math>p \log p\ 2^{O(\log^* p)}</math> time to multiply two ''p''-bit numbers.
 
By comparison, the most efficient randomized primality test for general integers, the [[Miller–Rabin primality test]], takes O(''k'' ''p''<sup>2</sup> log ''p'' log log ''p'') bit operations using FFT multiplication for a p-digit number (here p can be any natural number, not necessarily a prime), where ''k'' is the number of iterations and is related to the error rate. So it is in the same complexity class as the Lucas-Lehmer test for constant ''k''. But in practice the cost of doing many iterations and other differences leads to worse performance for Miller–Rabin. The most efficient deterministic primality test for general integers, the [[AKS primality test]], requires Õ(p<sup>6</sup>) bit operations in its best known variant and is dramatically slower in practice.
 
== Examples ==
 
Suppose we wish to verify that M<sub>3</sub> = 7 is prime using the Lucas–Lehmer test. We start out with ''s'' set to 4 and then update it 3&minus;2&nbsp;=&nbsp;1 time, taking the results mod 7:
 
* s ← ((4 &times; 4) &minus; 2) mod 7 = 0
 
Because we end with ''s'' set to zero, M<sub>3</sub> is prime.
 
On the other hand, M<sub>11</sub> = 2047 = 23 &times; 89 is not prime. To show this, we start with ''s'' set to 4 and update it 11&minus;2&nbsp;=&nbsp;9 times, taking the results mod 2047:
 
* s ← ((4 &times; 4) &minus; 2) mod 2047 = 14
* s ← ((14 &times; 14) &minus; 2) mod 2047 = 194
* s ← ((194 &times; 194) &minus; 2) mod 2047 = 788
* s ← ((788 &times; 788) &minus; 2) mod 2047 = 701
* s ← ((701 &times; 701) &minus; 2) mod 2047 = 119
* s ← ((119 &times; 119) &minus; 2) mod 2047 = 1877
* s ← ((1877 &times; 1877) &minus; 2) mod 2047 = 240
* s ← ((240 &times; 240) &minus; 2) mod 2047 = 282
* s ← ((282 &times; 282) &minus; 2) mod 2047 = 1736
 
Because ''s'' is not zero, M<sub>11</sub>=2047 is not prime. Notice that we learn nothing about the factors of 2047, only its Lucas–Lehmer residue, 1736.
 
== Proof of correctness ==
 
Lehmer's original proof of the correctness of this test is complex, so we'll depend upon more recent refinements. Recall the definition:
:<math>
  s_i=
  \begin{cases}
    4 & \text{if }i=0;
  \\
    s_{i-1}^2-2 & \text{otherwise.}
  \end{cases}
</math>
Then our theorem is that ''M''<sub>''p''</sub> is prime [[iff]] <math>s_{p-2}\equiv0\pmod{M_p}.</math>
 
We begin by noting that <math>{\langle}s_i{\rangle}</math> is a [[recurrence relation]] with a [[closed-form solution]]. Define <math>\omega = 2 + \sqrt{3}</math> and <math>\bar{\omega} = 2 - \sqrt{3}</math>; then we can verify by [[mathematical induction|induction]] that <math>s_i = \omega^{2^i} + \bar{\omega}^{2^i}</math> for all ''i'':
 
:<math>s_0 = \omega^{2^0} + \bar{\omega}^{2^0} = (2 + \sqrt{3}) + (2 - \sqrt{3}) = 4.</math>
:<math>\begin{array}{lcl}s_n & = & s_{n-1}^2 - 2 \\
                        & = & \left(\omega^{2^{n-1}} + \bar{\omega}^{2^{n-1}}\right)^2 - 2 \\
                        & = & \omega^{2^n} + \bar{\omega}^{2^n} + 2(\omega\bar{\omega})^{2^{n-1}} - 2 \\
                        & = & \omega^{2^n} + \bar{\omega}^{2^n}, \\
      \end{array}</math>
where the last step follows from <math>\omega\bar{\omega} = (2 + \sqrt{3})(2 - \sqrt{3}) = 1</math>. We will use this in both parts.
 
=== Sufficiency ===
 
In this direction we wish to show that <math>s_{p-2}\equiv0\pmod{M_p}</math> implies that <math>M_p</math> is prime. We relate a straightforward proof exploiting elementary [[group theory]] given by J. W. Bruce<ref>{{cite journal |author=J. W. Bruce |title=A Really Trivial Proof of the Lucas–Lehmer Test |journal=The American Mathematical Monthly |volume=100 |issue=4 |pages=370&ndash;371 |year=1993}}</ref> as related by Jason Wojciechowski.<ref>Jason Wojciechowski. [http://web.archive.org/web/20110722232101/http://wonka.hampshire.edu/~jason/math/smithnum/project.ps Mersenne Primes, An Introduction and Overview]. 2003.</ref>
 
Suppose <math>s_{p-2} \equiv 0 \pmod{M_p}</math>. Then
:<math>\omega^{2^{p-2}} + \bar{\omega}^{2^{p-2}} = kM_p</math>
for some integer ''k'', and:
:<math>\omega^{2^{p-2}} = kM_p - \bar{\omega}^{2^{p-2}}</math>
Multiplying by <math>\omega^{2^{p - 2}}</math>,
:<math>\left(\omega^{2^{p-2}}\right)^2 = kM_p\omega^{2^{p-2}} - (\omega\bar{\omega})^{2^{p-2}}</math>
Thus,
 
:<math>\omega^{2^{p-1}} = kM_p\omega^{2^{p-2}} - 1.\quad\quad\quad\quad\quad(1)</math>
 
Now suppose ''M''<sub>''p''</sub> is composite, and let ''q'' be the smallest prime factor of ''M''<sub>''p''</sub>. Since Mersenne numbers are odd, we have <math>q > 2</math>.  Informally,<ref group="note">Formally, let <math>\mathbb{Z}_q = \mathbb{Z}/q\mathbb{Z}</math> and <math>X = \mathbb{Z}_q[T]/\langle T^2 - 3 \rangle</math>.</ref> let <math>\mathbb{Z}_q</math> be the integers mod ''q'', let <math>X = \{a + b\sqrt{3} | a, b \in \mathbb{Z}_q\}</math>, and define multiplication in <math>X</math> using:
 
:<math>(a + \sqrt{3}b)(c + \sqrt{3}d) = [ac + 3bd \pmod{q}] + \sqrt{3}[bc + ad \pmod{q}].</math>
 
Clearly, this multiplication is closed, i.e. the product of numbers from ''X'' is itself in ''X''.  We shall denote the size of ''X'' as <math>| X |</math>.
 
Since ''q''&nbsp;>&nbsp;2, <math> ~ \omega </math> and <math>\bar{\omega}</math> are in ''X''.<ref group="note">Formally, <math> ~ \omega + \langle T^2 - 3 \rangle </math> and <math> \bar{\omega}+ \langle T^2 - 3 \rangle </math> are in ''X''.  By abuse of language we identify <math> ~ \omega</math> and <math>\bar{\omega}</math> with their images in ''X'' under the natural ring homomorphism from <math>\mathbb{Z}[\sqrt{3}] </math> to ''X'' which sends <math>\sqrt{3}</math> to ''T''.</ref>  ''X'' under multiplication is not a [[group (mathematics)|group]] under multiplication because not every element ''x'' has an inverse ''y'' such that <math>xy = 1</math>.<ref group="note">In fact, the set of non-zero elements of X is a group if and only if <math>\mathbb{Z}_q</math> does not contain a square root of 3.</ref> If we consider only the elements that have inverses, we get a group ''X''* of size <math>| X^* |</math>.  Since 0 has no inverse, <math>| X^* | \leq | X | - 1 = q^2 - 1</math>.
 
Now, since <math>M_p \equiv 0 \pmod{q}</math>, and <math>\omega \in X</math>, we have, in ''X'',
:<math>kM_p\omega^{2^{p-2}} = 0.</math> 
By equation (1),
:<math>\omega^{2^{p-1}} = -1</math>
and squaring both sides gives
:<math>\omega^{2^p} = 1.</math> 
Thus <math>\omega</math> lies in ''X''* and has inverse <math>\omega^{2^{p}-1}</math>.  Moreover, <math>\omega</math> has an [[order (group theory)|order]] dividing <math>2^p</math>.  However, <math>\omega^{2^{p-1}} \neq 1</math>, and so the order does not divide <math>2^{p-1}</math>. Thus,  the order must equal <math>2^p</math>.
 
Since the order of an element is at most the order (size) of the group, we conclude that
:<math>2^p \leq |X^*| = q^2 - 1 < q^2.</math>
But since ''q'' is the smallest prime factor of the composite <math>M_p</math>, we must have
:<math>q^2 \leq M_p = 2^p-1,</math>
yielding the contradiction <math>2^p < 2^p-1</math>. So <math>M_p</math> is prime.
 
=== Necessity ===
 
In the other direction, we suppose <math>M_p</math> is prime and show <math>s_{p-2} \equiv 0 \pmod{M_p}</math>. We rely on a simplification of a proof by Öystein J. R.
Ödseth.<ref>Öystein J. R. Ödseth. [http://www.uib.no/People/nmaoy/papers/luc.pdf A note on primality tests for N = h · 2<sup>n</sup> − 1]. Department of Mathematics, University of Bergen.</ref>
 
First, notice that 3 is a [[quadratic non-residue]] mod <math>M_p</math>, since <math>2^p - 1 \equiv 7 \pmod{12}</math> for odd <math>p > 1</math>, and so the [[Legendre symbol]] properties tell us <math>(3|M_p)</math> is &minus;1. [[Euler's criterion]] then gives us:
 
: <math>3^{\frac{M_p-1}{2}} \equiv -1 \pmod{M_p}.\,</math>
 
On the other hand, 2 is a [[quadratic residue]] mod <math>M_p</math>, since <math>2^p \equiv 1 \pmod{M_p}</math> and so <math>2 \equiv 2^{p+1} = \left(2^{\frac{p+1}{2}}\right)^2 \pmod{M_p}</math>. Euler's criterion again gives:
 
: <math>2^{\frac{M_p-1}{2}} \equiv 1 \pmod{M_p}.\,</math>
 
Next, define <math>\sigma = 2\sqrt{3}</math>, and define ''X''* as before as the field of units of <math>\{a + b\sqrt{3} | a, b \in \mathbb{Z}_{M_p}\}</math>.  We will use the following lemmas:
 
: <math>(x+y)^{M_p} \equiv x^{M_p} + y^{M_p} \pmod{M_p}</math>
 
(the [[Proofs of Fermat's little theorem#Proof using the binomial theorem|Binomial Theorem in a finite field]]) and
 
: <math>a^{M_p} \equiv a \pmod{M_p}</math>
 
for every integer ''a'' ([[Fermat's little theorem]]).
 
Then, in the field ''X''* we have:
 
:<math>
\begin{align}
(6+\sigma)^{M_p} & = 6^{M_p} + (2^{M_p})(\sqrt{3}^{M_p}) \\
                & = 6 + 2(3^{\frac{M_p-1}{2}})\sqrt{3} \\
                & = 6 + 2(-1)\sqrt{3} \\
                & = 6 - \sigma.
\end{align}
</math>
 
We chose <math>\sigma</math> such that <math>\omega = \frac{(6+\sigma)^2}{24}</math>. Consequently, we can use this to compute <math>\omega^{\frac{M_p+1}{2}}</math> in the field ''X''*:
 
:<math>\begin{align}
\omega^{\frac{M_p+1}{2}} & = \frac{(6 + \sigma)^{M_p+1}}{24^{\frac{M_p+1}{2}}} \\
                  & = \frac{(6 + \sigma)^{M_p}(6 + \sigma)}{(24 \cdot 24^{\frac{M_p-1}{2}})} \\
                  & = \frac{(6 - \sigma)(6 + \sigma)}{-24} \\
                  & = -1.
\end{align}</math>
 
where we use the fact that
 
: <math>24^{\frac{M_p-1}{2}} = (2^{\frac{M_p-1}{2}})^3(3^{\frac{M_p-1}{2}}) = (1)^3(-1) = -1.</math>
 
Since <math>M_p \equiv 3 \pmod 4</math>, all that remains is to multiply both sides of this equation by <math>\bar{\omega}^{\frac{M_p+1}{4}}</math> and use <math>\omega\bar{\omega}=1</math>:
 
: <math>\begin{align}
\omega^{\frac{M_p+1}{2}}\bar{\omega}^{\frac{M_p+1}{4}} & = -\bar{\omega}^{\frac{M_p+1}{4}} \\
\omega^{\frac{M_p+1}{4}} + \bar{\omega}^{\frac{M_p+1}{4}} & = 0 \\
\omega^{\frac{2^p-1+1}{4}} + \bar{\omega}^{\frac{2^p-1+1}{4}} & = 0 \\
\omega^{2^{p-2}} + \bar{\omega}^{2^{p-2}} & = 0 \\
s_{p-2} & = 0.
\end{align}</math>
 
Since <math>s_{p - 2}</math> is an integer and is zero in ''X''*, it is also zero mod <math>M_p</math>.
 
== Applications ==
 
The Lucas–Lehmer test is the primality test used by the [[Great Internet Mersenne Prime Search]] to locate large primes, and has been successful in locating many of the largest primes known to date.<ref>[http://primes.utm.edu/largest.html#biggest The "Top Ten" Record Primes], [[The Prime Pages]]</ref> The test is considered valuable because it can provably test a very large number for primality within affordable time and, in contrast to the equivalently fast [[Pépin's test]] for any [[Fermat number]], can be tried on a large search space of numbers with the required form before reaching computational limits.
 
== See also ==
* [[Mersenne's conjecture]]
* [[Lucas–Lehmer–Riesel test]]
* [[GIMPS]]
 
== Notes ==
<references group="note"/>
 
== References ==
{{reflist|2}}
* {{citation |first=Richard |last=Crandall |authorlink=Crandall, Richard |first2=Carl |last2=Pomerance |authorlink2=Carl Pomerance |year=2001 |title=Prime Numbers: A Computational Perspective |publisher=Springer |location=Berlin |edition=1st |isbn=0-387-94777-9 |chapter=Section 4.2.1: The Lucas–Lehmer test |page=167&ndash;170}}
 
== External links ==
* {{MathWorld |urlname=Lucas-LehmerTest |title=Lucas–Lehmer test}}
* [http://www.mersenne.org GIMPS (The Great Internet Mersenne Prime Search)]
* [http://arxiv.org/abs/0705.3664 A proof of Lucas–Lehmer–Reix test (for Fermat numbers)]
* [http://www.mersennewiki.org/index.php/Lucas-Lehmer_Test Lucas–Lehmer test] at MersenneWiki
 
{{number theoretic algorithms}}
 
{{DEFAULTSORT:Lucas-Lehmer Primality Test}}
[[Category:Primality tests]]

Latest revision as of 22:50, 24 December 2014

Adrianne Le is the brand my parents gave i but you can connect with me anything you prefer. My house is now all through South Carolina. Filing is my day job now but soon I'll getting on my own. What me and my family completely love is acting but All of us can't make it simple profession really. See what's new on individual website here: http://prometeu.net

My homepage: clash of clans hack no survey no password