fbpx
Wikipedia

Meissel–Lehmer algorithm

The Meissel–Lehmer algorithm (after Ernst Meissel and Derrick Henry Lehmer) is an algorithm that computes exact values of the prime-counting function.[1][2]

Description

The problem of counting the exact number of primes less than or equal to x, without actually listing them all, dates from Legendre. He observed from the Sieve of Eratosthenes that

 

where   is the floor function, which denotes the greatest integer less than or equal to x and the   run over all primes  .[1][2]

Since the evaluation of this sum formula is becoming more and more complex and confusing for large x, Meissel tried to simplify the counting of the numbers in the Sieve of Eratosthenes. He and Lehmer introduced therefore certain sieve functions, which are detailed below.

Key functions

Let   be the first n primes. For natural number a ≥ 1, define

 

which counts natural numbers no greater than x with all prime factors greater  . Also define for natural number k,

 

which counts natural numbers no greater than x with exactly k prime factors, all larger than  . With these, we have

 

where the sum only has finitely many nonzero terms, because   when  . Using the fact that  , we get

 

which prove that one may compute   by computing   and   for k ≥ 2. This is what the Meissel–Lehmer algorithm does.

Formula for Pk(x, a)

For k = 2, we get the following formula for  :

 

For k ≥ 3, the identities for   can be derived similarly.[1]

Expanding 𝜑(x, a)

Using the recurrence

 

  may be expanded. Each summand, in turn, may be expanded in the same way.

Combining the terms

The only thing that remains to be done is evaluating   and   for k ≥ 2, for certain values of x and a. This can be done by direct sieving and using the above formulas.

History

Meissel already found that for k ≥ 3,   if  . He used the resulting equation for calculations of   for big values of  . [1]

Meissel calculated   for values of x up to  , but he narrowly missed the correct result for the biggest value of x.[1]

Using his method and an IBM 701, Lehmer was able to compute the correct value of   and missed the correct value of   by 1.[1]

Extended algorithm

Jeffrey Lagarias, Victor Miller and Andrew Odlyzko published a realisation of the algorithm which computes   in time   and space   for any  .[2] Upon setting  , the tree of   has   leaf nodes.[2]

This extended Meissel-Lehmer algorithm needs less computing time than the algorithm developed by Meissel and Lehmer, especially for big values of x.

Further improvements of the algorithm are given by M. Deleglise and J. Rivat in 1996.[3]

References

  1. ^ a b c d e f Lehmer, Derrick Henry (April 1, 1958). "ON THE EXACT NUMBER OF PRIMES LESS THAN A GIVEN LIMIT". Illinois J. Math. 3 (3): 381–388. Retrieved February 1, 2017.
  2. ^ a b c d Lagarias, Jeffrey; Miller, Victor; Odlyzko, Andrew (April 11, 1985). "Computing  : The Meissel–Lehmer method" (PDF). Mathematics of Computation. 44 (170): 537–560. doi:10.1090/S0025-5718-1985-0777285-5. Retrieved September 13, 2016.
  3. ^ Deleglise, Marc; Rivat, Joël (January 15, 1996). "Computing  : The Meissel, Lehmer, Lagarias, Miller, Odlyzko method". Mathematics of Computation. 65 (213): 235–245. doi:10.1090/S0025-5718-96-00674-6.

meissel, lehmer, algorithm, after, ernst, meissel, derrick, henry, lehmer, algorithm, that, computes, exact, values, prime, counting, function, contents, description, functions, formula, expanding, 𝜑, combining, terms, history, extended, algorithm, referencesd. The Meissel Lehmer algorithm after Ernst Meissel and Derrick Henry Lehmer is an algorithm that computes exact values of the prime counting function 1 2 Contents 1 Description 1 1 Key functions 1 2 Formula for Pk x a 1 3 Expanding 𝜑 x a 1 4 Combining the terms 2 History 3 Extended algorithm 4 ReferencesDescription EditThe problem of counting the exact number of primes less than or equal to x without actually listing them all dates from Legendre He observed from the Sieve of Eratosthenes that p x p x 1 2 1 x i x p i i lt j x p i p j displaystyle pi x pi x 1 2 1 lfloor x rfloor sum i lfloor x p i rfloor sum i lt j lfloor x p i p j rfloor ldots where x displaystyle lfloor x rfloor is the floor function which denotes the greatest integer less than or equal to x and the p i displaystyle p i run over all primes x 1 2 displaystyle leq x 1 2 1 2 Since the evaluation of this sum formula is becoming more and more complex and confusing for large x Meissel tried to simplify the counting of the numbers in the Sieve of Eratosthenes He and Lehmer introduced therefore certain sieve functions which are detailed below Key functions Edit Let p 1 p 2 p n displaystyle p 1 p 2 ldots p n be the first n primes For natural number a 1 define f x a n x p n p gt p a displaystyle varphi x a left left n leq x p n implies p gt p a right right which counts natural numbers no greater than x with all prime factors greater p a displaystyle p a Also define for natural number k P k x a n x n q 1 q 2 q k with q 1 q k gt p a displaystyle P k x a left left n leq x n q 1 q 2 cdots q k text with q 1 ldots q k gt p a right right which counts natural numbers no greater than x with exactly k prime factors all larger than p a displaystyle p a With these we have f x a k 0 P k x a displaystyle varphi x a sum k 0 infty P k x a where the sum only has finitely many nonzero terms because P k x a 0 displaystyle P k x a 0 when p a k gt x displaystyle p a k gt x Using the fact that P 1 x a p x a displaystyle P 1 x a pi x a we get p x f x a a 1 k 2 P k x a displaystyle pi x varphi x a a 1 sum k 2 infty P k x a which prove that one may compute p x displaystyle pi x by computing f x a displaystyle varphi x a and P k x a displaystyle P k x a for k 2 This is what the Meissel Lehmer algorithm does Formula for Pk x a Edit For k 2 we get the following formula for P k x a displaystyle P k x a P 2 x a n n x n p b p c with a lt b c b a 1 p x 1 2 n n x n p b p c with b c p x p b b a 1 p x 1 2 p x p b b 1 a 2 p x 1 2 2 b a 1 p x 1 2 p x p b displaystyle begin aligned P 2 x a amp left left n n leq x n p b p c text with a lt b leq c right right amp sum b a 1 pi x 1 2 left left n n leq x n p b p c text with b leq c leq pi left frac x p b right right right amp sum b a 1 pi x 1 2 left pi left frac x p b right b 1 right amp binom a 2 binom pi x 1 2 2 sum b a 1 pi x 1 2 pi left frac x p b right end aligned For k 3 the identities for P k x a displaystyle P k x a can be derived similarly 1 Expanding 𝜑 x a Edit Using the recurrence f x a f x a 1 f x p a a 1 displaystyle varphi x a varphi x a 1 varphi left frac x p a a 1 right f x a displaystyle varphi x a may be expanded Each summand in turn may be expanded in the same way Combining the terms Edit The only thing that remains to be done is evaluating f x a displaystyle varphi x a and P k x a displaystyle P k x a for k 2 for certain values of x and a This can be done by direct sieving and using the above formulas History EditMeissel already found that for k 3 P k x a 0 displaystyle P k x a 0 if a p x 1 3 displaystyle a pi x 1 3 He used the resulting equation for calculations of p x displaystyle pi x for big values of x displaystyle x 1 Meissel calculated p x displaystyle pi x for values of x up to 10 9 displaystyle 10 9 but he narrowly missed the correct result for the biggest value of x 1 Using his method and an IBM 701 Lehmer was able to compute the correct value of p 10 9 displaystyle pi left 10 9 right and missed the correct value of p 10 10 displaystyle pi left 10 10 right by 1 1 Extended algorithm EditJeffrey Lagarias Victor Miller and Andrew Odlyzko published a realisation of the algorithm which computes p x displaystyle pi x in time O x 2 3 e displaystyle O x 2 3 varepsilon and space O x 1 3 e displaystyle O x 1 3 varepsilon for any e gt 0 displaystyle varepsilon gt 0 2 Upon setting a p x 1 3 displaystyle a pi x 1 3 the tree of f x a displaystyle varphi x a has O x 2 3 displaystyle O x 2 3 leaf nodes 2 This extended Meissel Lehmer algorithm needs less computing time than the algorithm developed by Meissel and Lehmer especially for big values of x Further improvements of the algorithm are given by M Deleglise and J Rivat in 1996 3 References Edit a b c d e f Lehmer Derrick Henry April 1 1958 ON THE EXACT NUMBER OF PRIMES LESS THAN A GIVEN LIMIT Illinois J Math 3 3 381 388 Retrieved February 1 2017 a b c d Lagarias Jeffrey Miller Victor Odlyzko Andrew April 11 1985 Computing p x displaystyle pi x The Meissel Lehmer method PDF Mathematics of Computation 44 170 537 560 doi 10 1090 S0025 5718 1985 0777285 5 Retrieved September 13 2016 Deleglise Marc Rivat Joel January 15 1996 Computing p x displaystyle pi x The Meissel Lehmer Lagarias Miller Odlyzko method Mathematics of Computation 65 213 235 245 doi 10 1090 S0025 5718 96 00674 6 Retrieved from https en wikipedia org w index php title Meissel Lehmer algorithm amp oldid 1087732925, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.