aa r X i v : . [ m a t h . G M ] J u l GENERATING PRIME NUMBERS - A FAST NEWMETHOD
V. VILFRED KAMALAPPAN
Abstract.
Let p , p , . . . denote the prime numbers 2 , , . . . numberedin increasing order. The following method is used to generate primes.Start with p = 2, p = 3, IpP = [2 , pP = { , } , MIpP = 3 = MpP , pP = 2 and for j = 1 , , . . . , MIpP j = max IpP j , MpP j =max pP j , pP j = | pP j | , IpP j +1 = [ MIpP j +1 , MpP j +4 MpP j +3] and pP j +1 = Φ( IpP j +1 ) = the set of all primes in IpP j +1 = Φ([ MIpP j + 1, MpP j + 4 MpP j + 2]). We use elementary method to obtain pP j +1 , j = 1 , , . . . . This algorithm generates primes in a faster way to anygiven limit and the width of interval IpP j +1 is a tight bound, in general,in the sense that if we increase further, then the algorithm fails. Also,we restate the Twin prime conjecture in an easier way. Key Words:
Prime number, composite number, AKS primality test, thesieve of Eratosthenes, Bertrand’s postulate, the standard pockets of primes,sequence of order of pockets of primes, Twin prime conjecture, Riemann zetafunction.—————— 1.
Introduction
The sieve of Eratosthenes [5, 17] and Bertrand’s postulate [3] are impor-tant mile stones in generating prime numbers. The sieve of Eratosthenes is avery simple ancient algorithm that generates primes up to any given limit andBertrand’s postulate establishes the existence of prime in an interval [ n, n ],for any n ≥
2. In 1845, Joseph Bertrand postulated that for any integer n >
3, there exists prime p such that n < p < n −
2. And its slightly weakerform is that there exists prime p such that n < p < n , n an integer ≥
2. In1850, Pafnuty Chebychev [19] first proved this postulate analytically. In 1932,Paul Erdos [5] gave an elementary proof using facts about the middle bino-mial coefficient. In 2002, Manindra Agarwal, Neeraj Kayal and Nitin Saxena[1] presented an unconditional deterministic polynomial-time algorithm thatdetermines whether an input number is prime or composite.The problem of computing π ( x ), the number of primes less than or equalto x is one of the oldest problem in Mathematics, x ∈ N . For a very long time, Mathematics Subject Classification. the sieve of Eratosthenes has been the practical way to compute π ( x ) despiteits time complexity. Legendre [11] observed a combinatorial formula, known as L egendre sum, for the number of primes p for which x < p ≤ x . Since then,a large number of writers have suggested variants and improvements of theformula. During 1870 to 1885, astronomer Meissel [13]-[16] developed practi-cal combinatorial method to compute π ( x ) and in 1959, Lehmer [11] extendedand simplified Meissel’s method. In 1985, the Meissel-Lehmer method [10] wasused to compute several values of π ( x ) up to x = 4 . and in 1996, Delegliseand Rivat [6] developed a modified form of the Meissel-Lehmer method savingmuch computation.In this article, we present a simple fast moving algorithm, using both thesieve of Eratosthenes and Bertrand’s postulate, to generate prime numbers.Let p , p , . . . denote the primes 2 , , . . . numbered in increasing order. Westart with obtaining primes in successive intervals of the form [ p i + 1 , p i ]and in each such interval Bertrand’s postulate ensures existence of prime(s).Then, the question arises is whether there exists any other method whichgenerates primes in a faster way? Our second method considers intervalsof the form [ p i + 1 , p i ] instead of [ p i + 1 , p i ], used in the first method andgenerates primes in a faster way, i ≥
2. Again, the question is whetherit is the ultimate method, in general, to generates primes in a faster way?And our third method is the answer for the above question. It considers[ p i + 1 , p i + 4 p i + 3] as successive intervals and the width of the interval, ingeneral, is a tight bound in the sense that if we increase the width further, thenthe algorithm fails. All the three methods are presented here for more clarity.The author feels that this development is going to revolutionise development inMathematics, especially in Cryptography, Number theory, Signal processingand Computational Mathematics.Algorithms used in the three methods are ( i ) p = 2, IpP = { } = pP , M IpP = 2 = M pP , pP = 1 and other successive intervals IpP j +1 =[ M IpP j + 1 , M pP j ] and pP j +1 = Φ( IpP j +1 ) = set of all primes in IpP j +1 for j = 1 , , . . . ; ( ii ) p = 2, p = 3, IpP = [2 , pP = { , } , M IpP = 3 = M pP , pP = 2, IpP j +1 = [ M IpP j + 1 , M pP j ] and pP j +1 = Φ([ M IpP j + 2 ,M pP j − j = 1 , , . . . and ( iii ) p = 2, p = 3, IpP = [2 , pP = { , } , M IpP = 3 = M pP , pP = 2, M IpP j = max IpP j , M pP j =max pP j , pP j = | pP j | , IpP j +1 = [ M IpP j + 1 , M pP j +4 M pP j + 3] and pP j +1 = Φ( IpP j +1 ) = Φ([ M IpP j + 1 , M pP j + 4 M pP j + 2]) for j = 1 , , . . . .We use elementary method to obtain pP j +1 , the set of all primes in IpP j +1 , j = 1 , , . . . . After generating primes, it is easy to check, from the listing,whether any given number is prime or not, provided the number is within thelist. We discuss Riemann zeta function [9] related to prime generation andrestate the Twin prime conjecture [21] in an easier way. ENERATING PRIMES - A FAST NEW METHOD 3 Preliminaries
To simplify our work, the following notations are used in this paper. N = { , , . . . } ; N = N ∪ { } = { , , , . . . } ; P = the set of all prime numbers; C = the set of all composite numbers so that P ∩ C = Φ and P ∪ C = N − { } ; P ( S ) = Φ( S ) = the set of all primes in the set S and C ( S ) = the set of all composite numbers in S , S ⊆ N ; π ( S ) = the number of primes in S when S is finite and S ⊂ N ;Φ( n ) = Φ([1 , n ]) = the set of all primes ≤ n and π ( n ) = π ([1 , n ]) = the number of primes ≤ n , n ∈ N ; (cid:4) mn (cid:5) = integer part of mn when m, n ∈ N .Throughout the paper, for m, n ∈ N and m ≤ n , [ m, n ] = { k ∈ N : m ≤ k ≤ n } and p , p , . . . denotes the primes 2, 3, . . . numbered in increasing order. Definition 1.
Let a, n , n ∈ N , n ≤ n and [ a ] = { a, a, . . . } = a N , the setof multiples of a in N . Then, we denote the set of all multiples of a each liesbetween n and n by ([ a ] : n , n ) . Thus, ([ a ] : n , n ) = { ka/ n ≤ ka ≤ n , k ∈ N } , a, n , n ∈ N and n ≤ n . The following lemma is an important result used in this paper to generatelarger primes.
Lemma 2.1.
Let ≤ i < j , i, j ∈ N , p i , p j be primes, Q i,j = j p j p i k , Q ′ i,j = j p j p i k , Q ′′ i,j = j p j p i k and Q ′′′ i,j = j p j +4 p j +3 p i k . Then, (1) p i ( Q i,j + 1) is the smallest integer multiple of p i that is greater than p j . (2) p i Q ′ i,j is the biggest integer multiple of p i that is less than or equal to p j . (3) p i Q ′′ i,j is the biggest integer multiple of p i that is less than or equal to p j . (4) p i Q ′′′ i,j is the biggest integer multiple of p i that is less than or equal to p j + 4 p j + 3 . (5) ([ p i ] : p j + 1 , p j ) = { p i ( Q i,j + 1) , p i ( Q i,j + 2) , . . . , p i Q ′ i,j } . (6) ([ p i ] : p j + 1 , p j ) = { p i ( Q i,j + 1) , p i ( Q i,j + 2) , . . . , p i Q ′′ i,j } . (7) ([ p i ] : p j + 1 , p j + 4 p j + 3) = { p i ( Q i,j + 1) , p i ( Q i,j + 2) , . . . , p i Q ′′′ i,j } . (8) In [ p j + 1 , p j + 4 p j + 3] , any composite number has p , p , . . . or p j as a divisor. And p j + 4 p j + 3 < p j +1 . (9) For j ≥ , any composite number whose prime divisors, each > p j will be ≥ p j +1 ≥ ( p j + 2) > p j + 4 p j + 3 . V. VILFRED KAMALAPPAN
Proof.
Given, 1 ≤ i < j , Q i,j = j p j p i k , Q ′ i,j = j p j p i k , Q ′′ i,j = j p j p i k and Q ′′′ i,j = j p j +4 p j +3 p i k . This implies, p i < p j and Q i,j , Q ′ i,j , Q ′′ i,j , Q ′′′ i,j are thequotients when p j , 2 p j , p j , p j + 4 p j + 3 are divided by p i , respectively.Let p j = p i Q i,j + R i,j where Q i,j and R i,j are quotient and remainderwhen p j is divided by p i , 1 ≤ R i,j ≤ p i − p j is a prime numbergreater than p i . Similarly, let 2 p j = p i Q ′ i,j + R ′ i,j , p j = p i Q ′′ i,j + R ′′ i,j and p j + 4 p j + 3 = p i Q ′′′ i,j + R ′′′ i,j where Q ′ i,j and R ′ i,j are quotient and remainderwhen 2 p j is divided by p i , Q ′′ i,j and R ′′ i,j are quotient and remainder when p j isdivided by p i and Q ′′′ i,j and R ′′′ i,j are quotient and remainder when p j + 4 p j + 3is divided by p i , 0 ≤ R ′ i,j , R ′′′ i,j ≤ p i − ≤ R ′′ i,j ≤ p i −
1. From the above,we get results (1), (2), (3) and (4).Result (5) follows from (1) and (2). Result (6) follows from (1), (3) and p j is an odd prime >
2. Result (7) follows from (1) and (4).For j ≥ p j +1 ≥ p j + 2 > p j . This implies, the smallest compositenumber which does not have p , p , . . . or p j as a divisor is p j +1 . And p j +1 ≥ ( p j + 2) = p j + 4 p j + 4 > p j + 4 p j + 3 for j ≥
2. Hence, we get results(8) and (9). (cid:3) Main Result
In this section, we present all the three methods to generate prime numberseven though the third is the best. In all the three methods, we obtain allprime numbers in each interval
IpP k +1 by elementary method; in the interval[ p k +1 , p k ] using Theorems 3.1 and 3.2 in the first method; in [ p k +1, p k ] usingTheorems 3.3 and 3.4 in the second method and finally in [ p k + 1, p k + 4 p k + 3]using Theorems 3.5 and 3.6 in the third method, k ≥ Lemma 3.1.
Let ≤ i < j , Q i,j = j p j p i k , Q ′ i,j = j p j p i k , Q ′′ i,j = j p j p i k , Q ′′′ i,j = j p j +4 p j +3 p i k and i, j ∈ N . Then, (1) the set of all composite numbers in [ p j + 1 , p j ] is given by C ([ p j + 1 , p j ]) = S ji =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′ i,j } = S j − i =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′ i,j } S { p j } ; (2) the set of all composite numbers in [ p j + 1 , p j ] is given by C ([ p j + 1 , p j ]) = S ji =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′′ i,j } ; (3) the set of all composite numbers in [ p j + 1 , p j + 4 p j + 3] is given by C ([ p j + 1 , p j + 4 p j + 3]) = S ji =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′′′ i,j } ; (4) the number of primes in [ p j + 1 , p j ] is given by π ([ p j + 1 , p j ]) = π (2 p j ) − j ; (5) the number of primes in [ p j + 1 , p j ] is given by ENERATING PRIMES - A FAST NEW METHOD 5 π ([ p j + 1 , p j ]) = π ( p j ) − j and (6) the number of primes in [ p j + 1 , p j + 4 p j + 3] is given by π ([ p j + 1 , p j + 4 p j + 3]) = π ( p j + 4 p j + 3) − j .Proof. Given, 1 ≤ i < j , Q i,j = j p j p i k and Q ′ i,j = j p j p i k . Then,(1) the set of all composite numbers in [ p j + 1 , p j ] is C ([ p j + 1 , p j ]) = S ji =1 { multiples of p i in [ p j + 1 , p j ] } .= S ji =1 ([ p i ] : p j + 1 , p j ).= { p j } S ( S j − i =1 { p i ( Q i,j + 1) , p i ( Q i,j + 2) , . . . , p i Q ′ i,j } )using (5) of Lemma 2.1 and also 2 p j is the only compositenumber with p j as a divisor in [ p j + 1 , p j ].Proof of (2) and (3) are similar to (1) and (4)-(6) are obvious.Hence, the lemma is true. (cid:3) Prime numbers in [ p j + 1 , p j ] , j ≥ . Here, for j ≥
2, we obtain all prime numbers contained in the interval[ p j + 1 , p j ] by removing its composite numbers. Theorem 3.1.
Let ≤ i < j , i, j ∈ N , Q i,j = j p j p i k and Q ′ i,j = j p j p i k . Then,the set [ p j + 1 , p j ] \ C ([ p j + 1 , p j ])(1) = [ p j + 2 , p j − \ C ([ p j + 2 , p j − . (2) is non-empty. (3) contains prime number(s) as its element(s). (4) = Φ([ p j + 1 , p j ]) = Φ([ p j + 2 , p j − = the set of all prime numbers contained in [ p j + 1 , p j ] . (5) = [ p j + 1 , p j ] \ ( S ji =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′ i,j } ) . (6) = [ p j + 2 , p j − \ ( S j − i =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′ i,j } ) .Proof. For j ≥
2, the set of all prime numbers contained in [ p j + 1 , p j ] isobtained by removing all composite numbers contained in [ p j + 1 , p j ].For j ≥
1, by Bertrand’s postulate, [ p j + 1 , p j ] contains at least one primeand for j ≥ p j + 1 is composite. Hence, results (1), (2) and (3) are true.By the definition of Φ( S ), (4) is true.For j ≥
2, using (1), [ p j + 2 , p j ] contains at least one prime. And anyprime number contained in [ p j + 2 , p j ] is greater than p j and less than 2 p j .But for j ≥
2, any composite number in [ p j + 2 , p j ] contains p , p , . . . or p j as a factor. Hence, after removing all multiples of p , p , . . . , p j from[ p j + 2 , p j ], the resultant set contains only prime(s). This implies,[ p j + 1 , p j ] \ C ([ p j + 1 , p j ])= [ p j + 2 , p j ] \ C ([ p j + 2 , p j ]) = Φ([ p j + 2 , p j ])= [ p j + 2 , p j − \ ( S j − i =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′ i,j } ) V. VILFRED KAMALAPPAN using Lemma 3.1 where Q i,j = j p j p i k and Q ′ i,j = j p j p i k and 1 ≤ i < j . Andthereby (5) and (6) are true. (cid:3) In the above result, we could see that Φ([ p j + 2 , p j ]), the set of all primenumbers in the interval [ p j + 1 , p j ], is a non-empty set for every j ≥ j ∈ N . Consider the following example to calculate different primes usingTheorem 3.1 with the notation of M IpP j = maximum value in IpP j , M pP j = maximum value in pP j and π ( IpP j ) = number of prime numbers in IpP j = π ( pP j ) = | pP j | , j = 1 , , . . . . Example 1. p = 2 , IpP = { } = pP , M IpP = 2 = M pP . ⇒ IpP = [ M IpP + 1 , M pP ] = [3 , , M IpP = 4 , pP = Φ( IpP ) = Φ([3 , { } , p = 3 , M pP = 3 . ⇒ IpP = [ M IpP + 1 , M pP ] = [5 , , M IpP = 6 , pP = Φ( IpP ) = Φ([5 , = { } , p = 5 , M pP = 5 . ⇒ IpP = [ M IpP + 1 , M pP ] = [7 , , M IpP = 10 , pP = Φ( IpP ) = { } , p = 7 , M pP = 7 . ⇒ IpP = [ M IpP + 1 , M pP ] = [11 , , M IpP = 14 , pP = Φ( IpP ) = Φ([11 , = { , } , M pP = 13 , p = 11 , p = 13 . ⇒ IpP = [ M IpP + 1 , M pP ] = [15 , , M IpP = 26 , pP = Φ( IpP ) = Φ([15 , = { , , } , M pP = 23 , p = 17 , p = 19 , p = 23 . ⇒ IpP = [ M IpP + 1 , M pP ] = [27 , , M IpP = 46 , pP = Φ( IpP ) = Φ([27 , { , , , , } , p = 29 , p = 31 , p = 37 , p = 41 , p = 43 , M pP = 43 . ⇒ IpP = [ M IpP + 1 , M pP ] = [47 , , M IpP = 86 , pP = Φ( IpP ) = Φ([47 , { , , , , , , , , } , p = 47 , p = 53 , p = 59 , p = 61 , p = 67 , p = 71 , p = 73 , p = 79 , p = 83 , M pP = 83 . ⇒ IpP = [ M IpP + 1 , M pP ] = [87 , , M IpP = 166 , pP = Φ( IpP ) = Φ([87 , { , , , , , , , , , , , , , , } , M pP = 163 , p = 89 , p = 97 , p = 101 , p = 103 , p = 107 , p = 109 , p = 113 , p = 127 , p = 131 , p = 137 , p = 139 , p = 149 , p = 151 , p = 157 , p = 163 . ⇒ IpP = [ M IpP + 1 , M pP ] = [167 , , M IpP = 326 , pP = Φ( IpP ) = Φ([167 , {
167 = p , , , , , , , , , , , , , , , , , , , , , , , , , , ,
317 = p } , . . . . With the notation, pP = { } , pP = { } , pP = { } , pP = { } , pP = { , } , pP = { , , } , . . . , IpP i +1 = [ M IpP i + 1 , M pP i ] and pP i +1 =Φ( IpP i +1 ) where M IpP i = max IpP i = the maximum value in IpP i and ENERATING PRIMES - A FAST NEW METHOD 7
M pP i = max pP i , i = 2 , , . . . , we obtain the following result. Hereafter, wecall pP i as the i th pocket of prime(s) , i ∈ N . Theorem 3.2.
Let pP = { } , IpP = { } , IpP = [3 , , pP = { } , IpP =[5 , , pP = { } , IpP = [7 , , pP = { } , IpP = [11 , , pP = { , } , . . . where IpP i +1 = [ M IpP i + 1 , M pP i ] , pP i +1 = Φ( IpP i +1 ) , M IpP i = max IpP i = the maximum value in IpP i and M pP i = max pP i = the maximumvalue in pP i , i = 2 , , . . . . Then, (1) The set of all prime numbers, P = Φ( N ) = pP ∪ pP ∪ pP ∪ . . . = S ∞ j =1 pP j . (2) the set of all pockets of primes, { pP , pP , . . . , pP i , . . . } partitions the set of all primes. (cid:3) Observation 1. (1)
To obtain the set of all primes P , one can consider different set ofpockets of primes. (2) A set of pockets of primes whose union is the set of all primes neednot be a partition of P . We have generated prime numbers from successive intervals
IpP j +1 ; in eachsuccessive interval we obtain all its primes and thereby the correspondingpockets of primes pP j +1 = Φ([ M IpP j + 1 , M pP j ]) for j = 1 , , . . . , startingwith pP = { } , IpP = { } , IpP j +1 = [ M IpP i + 1 , M pP i ], M IpP j = max IpP j and M pP j = max pP j . Now, the question is ‘Is it possible to find out anybetter method to generate primes?’ The following method based on IpP j +1 = [ M IpP j + 1 , M pP j ] and pP j +1 = Φ( IpP j +1 ) = Φ([ M IpP j + 2 , M pP j − M IpP j = maximum value in IpP j and M pP j = maximum value in pP j with p = 2, pP = { } , IpP = { } = pP and p = 3 = M IpP = M pP for j = 2 , , . . . is a better method. To begin with, let us calculate prime numbersin [ p j + 1 , p j ] , j ≥ Prime numbers in [ p j + 1 , p j ] , j ≥ . Here, we obtain prime numbers by considering successive intervals
IpP j +1 as [ p j + 1 , p j ] instead of [ p j + 1 , p j ] in the previous method for j ≥ p = 2, p = 3, . . . . Interval [ p j + 1 , p j ], in general, contains more primes thanin [ p j + 1 , p j ] for j ≥
2. Similar to Theorem 3.1, we get Theorems 3.3 asfollows.
Theorem 3.3.
For j ≥ , the set [ p j + 1 , p j ] \ C ([ p j + 1 , p j ])(1) is non-empty; (2) contains prime number(s) as its element(s); (3) = Φ([ p j + 1 , p j ]) = Φ([ p j + 2 , p j − ; (4) = [ p j + 2 , p j − \ ( S ji =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′′ i,j } ) where Q i,j = j p j p i k and Q ′′ i,j = j p j − p i k , ≤ i ≤ j . V. VILFRED KAMALAPPAN
Proof.
By Bertrand’s postulate, [ p j +1 , p j ] contains at least one prime, j ∈ N .For j ∈ N , [ p j + 1 , p j ] ⊇ [ p j + 1 , p j ] and so [ p j + 1 , p j ] contains at least oneprime since p j ≥
2. Also, for j ≥ p j is odd prime and p j an odd compositenumber. And hence the set of all prime numbers contained in [ p j + 1 , p j ] issame as the set of all prime numbers contained in [ p j +2 , p j −
2] and is obtainedby removing all composite numbers contained in [ p j + 2 , p j − j ≥
2, using (1), [ p j + 2 , p j −
2] contains at least one prime. And anyprime number contained in [ p j + 1 , p j ] is greater than p j and less than p j for j ≥
2. Also, for k, l ∈ N , prime numbers p j + k , p j + l > p j and p j + k p j + l > p j .This implies, p , p , . . . , p j − or p j is a divisor of every composite numbercontained in [ p j + 1 , p j ] and after removal of all composite numbers that aremultiples of p , p , . . . or p j from [ p j + 1 , p j ], the resultant set contains onlyprime(s). This implies,[ p j + 1 , p j ] \ C ([ p j + 1 , p j ]) = Φ([ p j + 1 , p j ])= [ p j + 2 , p j − \ C ([ p j + 2 , p j − p j + 1 is even for j ≥ p j +2 , p j − \ ( S ji =1 p i { Q i,j +1 , Q i,j +2 , . . . , Q ′′ i,j } ) follows from Lemma3.1 where Q i,j = j p j p i k and Q ′′ i,j = j p j − p i k , 1 ≤ i ≤ j .Hence, result (4) is true. (cid:3) In the above result, Φ([ p j + 1 , p j ]), the set of all prime number(s) inthe interval [ p j + 1 , p j ], is a non-empty set for every j using Bertrand’spostulate, j ∈ N . Now, let us calculate different pockets of primes pP j +1 = Φ([ M IpP j + 2 , M pP j − p = 2, IpP = { } = pP , π ( pP ) = | pP | = 1, M IpP = 2 = M pP , IpP = [ M IpP +1 , M pP ] = [3 , pP =Φ( IpP ) = { } , π ( pP ) = 1, M IpP = 4, M pP = 3 = p π ( pP )+ π ( pP ) = p , IpP j +1 = [ M IpP j +1, M pP j ], pP j +1 = Φ([ M IpP j +2 , M pP j − M pP j +1 =max pP j +1 = p π ( pP )+ π ( pP )+ ... + π ( pP j )+ π ( pP j +1 ) and π ( pP j +1 ) = | pP j +1 | , j ≥ j ∈ N . Here, we obtain pP j from IpP j using Theorem 3.3.(4). Example 2.
Let p = 2 , IpP = { } = pP , π ( pP ) = 1 = | pP | , M IpP =2 = M pP . ⇒ IpP = [ M IpP + 1 , M pP ] = [3 , , pP = Φ( IpP ) = { } , π ( pP ) = | pP | = 1 , M pP = 3 = p π ( pP )+ π ( pP ) = p , M IpP = 4 . ⇒ IpP = [ M IpP + 1 , M pP ] = [5 , , M IpP = 9 , pP = Φ( IpP ) = { , } , π ( pP ) = | pP | = 2 , M pP = 7 = p π ( pP )+ π ( pP )+ π ( pP ) = p . ⇒ IpP = [ M IpP + 1 , M pP ] = [10 , , M IpP = 49 , pP = Φ( IpP ) = Φ([10 , , { , , , , , , , , , , } , π ( pP ) = 11 , p π ( pP )+ π ( pP )+ π ( pP )+1 = p = 11 , p = 13 , p = 17 , p = 19 , p = 23 , p = 29 , p = 31 , p = 37 , p = 41 , p = 43 , ENERATING PRIMES - A FAST NEW METHOD 9 p = 47 = M pP = p π ( pP )+ π ( pP )+ π ( pP )+ π ( pP ) . ⇒ IpP = [ M IpP + 1 , M pP ] = [50 , , M IpP = 2209 , pP = Φ( IpP ) = Φ([ M IpP + 1 , M pP ]) = Φ([51 , , = { , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , } , π ( pP ) = 314 , p = p = 53 , p = 59 , . . . , p π ( pP ) = p = M pP = 2207 . ⇒ IpP = [ M IpP + 1 , M pP ] = [2210 , , M IpP = 4870849 , pP = Φ([ M IpP + 2 , M pP − , { p , p , . . . , p } , π ( pP ) = 339730 , M pP = 4870843 = p npP = p , . . . . Continuing the above process of obtaining prime numbers from successivepockets of primes, one can generate consecutive prime numbers up to any givenlimit. The algorithm used here is p = 2, IpP = { } = pP , π ( pP ) = | pP | =1, M IpP = 2 = M pP , p = 3, IpP = { } = pP , M IpP = 3 = M pP , π ( pP ) = 1, then IpP i +1 = [ M IpP i + 1 , M pP i ], M pP i = max pP i = themaximum value of pP i = the biggest prime in pP i = the biggest prime in IpP i , pP i +1 = the ( i + 1) th pocket of primes = Φ([ M IpP i + 2 , M pP i − π ( pP i +1 ) = | pP i +1 | , i = 2 , , . . . . Remark 1.
The above algorithm works since
M pP i is composite and odd forevery i ≥ whereas M pP = 4 is even. Thus, corresponding to the abovealgorithm, we get Theorem 3.4. Theorem 3.4.
Let p = 2 , IpP = { } = pP , p = 3 , IpP = { } = pP , p = 3 = M IpP = M pP , IpP i +1 = [ M IpP i + 1 , M pP i ] and pP i +1 =Φ([ M IpP i + 2 , M pP i − where M IpP i = max IpP i and M pP i = max pP i , i = 2 , , . . . . Then, the pockets of primes are (1) pP = Φ( { } ) = { } , pP = Φ( { } ) = { } , pP = { , } , pP = {
11 = p , , , , , , , , , ,
47 = p } ; pP = {
53 = p ,
59 = p , , . . . , p = M pP } , pP = { p , p , . . . , p } , . . . . (2) The set of all prime numbers, P = Φ( N ) = S ∞ j =1 pP j = pP S pP S ( S ∞ j =2 Φ([
M IpP j + 2 , M pP j − pP S pP S (lim n →∞ ( S nj =2 Φ([
M IpP j + 2 , M pP j − . (3) The set of all pockets of primes, { pP , pP , . . . } partitions the set ofall prime numbers, P .Proof. Here, for i = j and i, j ∈ N , pP i ∩ pP j = Φ and each pocket ofprime(s) is non-empty by Bertrand Postulate. Also, the set of all intervals IpP j partition N \ { } and each interval IpP j covers pocket of prime(s) pP j , j = 1 , , . . . . Then, the theorem is true from the following. P = Φ( N ) = S ∞ j =1 pP j = lim n →∞ ( S nj =1 pP j )= pP S pP S (lim n →∞ ( S nj =2 Φ([
M pP j + 2 , M pP j − (cid:3) Remark 2.
In the two methods that we have discussed to generate primenumbers using successive pockets of prime(s) pP , pP , . . . with IpP = { } = pP , IpP = { } = pP , M IpP j = max IpP j and M pP j = max pP j ,in the first method we have IpP j +1 = [ M IpP j + 1 , M pP j ] and pP j +1 =Φ( IpP j +1 ) = Φ([ M IpP j +1 , M pP j ]) for j = 2 , , . . . and in the secondmethod IpP j +1 = [ M IpP j +1 , M pP j ] and pP j +1 = Φ( IpP j +1 ) = Φ([ M IpP j +2 , M pP j − for j = 2 , , . . . . Let π ( pP j ) = | pP j | , j = 1 , , . . . . It is easy toobserve the following. (1) The second method is better than the first in terms of number of primesgenerated in successive pockets of primes. The number of elements inthe successive pockets of primes in the two methods are as follows.
Method-1: π ( pP ) = 1 , π ( pP ) = 1 , π ( pP ) = 1 , π ( pP ) = 1 , π ( pP ) = 2 , π ( pP ) = 3 , π ( pP ) = 5 , π ( pP ) = 9 , π ( pP ) = 15 , π ( pP ) = 28 , . . . . Method-2: π ( pP ) = 1 , π ( pP ) = 1 , π ( pP ) = 2 , π ( pP ) = 11 , π ( pP ) = 314 , π ( pP ) = 339730 , . . . . ENERATING PRIMES - A FAST NEW METHOD 11
See Table for more details. (2) To generate prime numbers, if we consider any bigger interval of theform [ M IpP j +1 , M pP j + k ] in the previous methods, then the methodmay fail since [ M IpP j +1 , M pP j + k ] may contain composite numbersof the form M pP j + m for some k and m such that ≤ m ≤ k andeach of its prime divisor is > M pP j . (3) In the previous remark, let us ask the question, whether there existssuch a value of k for which the algorithm works, in general, to generateprime numbers? If it exists, is it possible to find out such value(s) of k ? And what is the maximum general value of k ? Yes, such valuesof k exist. See the following. (4) For p = 2 , p = 3 , pP = { , } , IpP = [2 , and j ≥ , p j isan odd prime and the next prime p j +1 ≥ p j + 2 and so p j +1 p j +1 ≥ ( p j + 2) = p j + 4 p j + 4 > p j + 4 p j + 3 . This implies, k = 4 p j + 3 is a possible value of k , in general, for which the following algorithmworks. p = 2 , p = 3 , IpP = [2 , , pP = { , } , π ( pP ) = 2 , M IpP = 3 = M pP = p , k = 4 M pP j + 3 , IpP j +1 = [ M IpP j + 1 , M pP j + k ] , pP j +1 = Φ([ M IpP j + 1 , M pP j + k − , π ( pP j +1 ) = | pP j +1 | , M IpP j +1 = max IpP j +1 and M pP j +1 = max pP j +1 = p π ( pP )+ π ( pP )+ ... + π ( pP j +1 ) .Here, M pP j + 4 M pP j + 3 is even for j = 1 , , . . . . (5) Continuing the above process of generating primes from successivepockets of primes, one can generate consecutive prime numbers up toany given limit. Thus, corresponding to the third method, we get thefollowing important result.
Remark 3.
In the above algorithm if we take k = 4 M pP j + 4 instead of M pP j + 3 , then the algorithm fails when M pP j and its successive prime aretwin primes (two primes of difference two). Thus, k = 4 M pP j +3 is a possible,in general, maximum value of k used in the third method to generate successiveprimes and correspondingly we get the most important result, Theorem 3.5. Theorem 3.5.
Let j ∈ N and k ∈ N . Then, (1) k = 4 M pP j +3 is a possible, in general, maximum value of k for whichthe following algorithm works to generate successive prime numbersfrom successive pocket of primes and doesn’t fail. p = 2 , p = 3 , IpP = [2 , , pP = { , } , π ( pP ) = | pP | = 2 , M pP = 3 = M IpP = p π ( pP ) = p , IpP j +1 = [ M IpP j + 1 , M pP j + k ] , M IpP j = max IpP j , pP j +1 = Φ([ M IpP j + 1 , M pP j + k − , π ( pP j +1 ) = | pP j +1 | and M pP j +1 = max pP j +1 = p π ( pP )+ π ( pP )+ ... + π ( pP j +1 ) for j = 1 , , . . . . (2) Let
IpP = [2 , , pP = { , } , p = 2 , p = 3 , π ( pP ) = 2 and M IpP = 3 = M pP = p π ( pP ) = p . Then, the set of all primes, P = S ∞ j =1 pP j = lim n →∞ ( S nj =1 pP j )= pP S (lim n →∞ ( S nj =1 Φ([
M IpP j + 1 , M pP j + 4 M pP j + 2]))) where IpP j +1 = [ M IpP j + 1 , M pP j + 4 M pP j + 3] , M IpP j = max IpP j , pP j +1 = Φ( IpP j +1 ) = Φ([ M IpP j + 1 , M pP j + 4 M pP j +2]) , π ( pP j +1 ) = | pP j +1 | and M pP j +1 = p π ( pP )+ π ( pP )+ ... + π ( pP j +1 ) = max pP j +1 , j = 1 , , . . . . (cid:3) Definition 2.
Let pP = { , } , p = 2 , p = 3 , π ( pP ) = 2 , IpP =[2 , , M IpP = 3 = M pP , IpP j +1 = [ M IpP j + 1 , M pP j +4 M pP j + 3] , M IpP j +1 = max IpP j +1 , pP j +1 = Φ([ M IpP j + 1 , M pP j +4 M pP j + 2]) , π ( pP j +1 ) = | pP j +1 | and M pP j +1 = p π ( pP )+ π ( pP )+ ... + π ( pP j +1 ) = max pP j +1 , j = 1 , , . . . . Then, pP , pP , . . . are called the standard pockets of primes. Theorem 3.6.
For j ≥ , the set [ p j +1 , p j +4 p j +3] \ C ([ p j +1 , p j + 4 p j +3])(1) is non-empty; (2) contains prime number(s) as its element(s); (3) = Φ([ p j + 1 , p j + 4 p j + 3]) = Φ([ p j + 2 , p j + 4 p j + 2]) ; (4) = [ p j + 2 , p j + 4 p j + 2] \ ( S ji =1 p i { Q i,j + 1 , Q i,j + 2 , . . . , Q ′′′ i,j } ) where Q i,j = j p j p i k and Q ′′′ i,j = j p j +4 p j +2 p i k , ≤ i ≤ j .Proof. Proof is similar to Theorem 3.3. (cid:3)
Now, let us calculate the standard pockets of primes using Theorem 3.6.
Example 3. p = 2 , p = 3 , IpP = [2 , , pP = { , } , M IpP = 3= M pP , π ( pP ) = 2 ; ⇒ IpP = [ M IpP + 1 , M pP + 4 M pP + 3] = [4 , , M IpP = 24 , pP = Φ([ M IpP + 2 , M pP + 4 M pP + 2]) = Φ([5 , { , , , , , , } , π ( pP ) = 7 , p = 5 , p = 7 , p = 11 , p = 13 , p = 17 , p = 19 , p = 23 , M pP = 23 = p π ( pP )+ π ( pP ) = p ; ⇒ IpP = [ M IpP + 1 , M pP + 4 M pP + 3] = [25 , , M IpP = 624 , pP = Φ([ M IpP + 2 , M pP + 4 M pP + 2])= Φ([26 , { , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , } , π ( pP ) = 105 , ENERATING PRIMES - A FAST NEW METHOD 13
M pP = 619 = p π ( pP ) = p , p = 29 , p = 31 , . . . , p = 619 ; ⇒ IpP = [ M IpP + 1 , M pP + 4 M pP + 3] = Φ([625 , , M IpP = 385640 , pP = Φ([ M IpP + 2 , M pP + 4 M pP + 2])= Φ([626 , { , , . . . , } , π ( pP ) = 32622 , M pP = 385639 = p π ( pP ) = p , p = 631 , p = 641 , . . . , M pP = p ; ⇒ IpP = [ M IpP + 1 , M pP + 4 M pP + 3]= Φ([385641 , , M IpP = 148718980880 , pP = Φ([ M IpP + 2 , M pP + 4 M pP + 2])= Φ([385642 , { p , p , . . . , M pP = biggest prime ≤ } , π ( pP ) = | pP | , M pP = p π ( pP ) ; . . . . On Twin Prime Conjecture
One great open problem in number theory formany years is the twin prime conjecture, which states that there are infinitelymany primes p such that p + 2 is also prime [21]. Here, we restate the twinprime conjecture in terms of the standard pockets of primes that may help tosettle the conjecture in an easier way. Conjecture 1. [Twin Prime Conjecture interms of pockets of primes]
Each pocket of primes of the standard pockets of primes contains at least onepair of twin primes.
Remark 4. (1)
If we prove the above conjecture, then the Twin primeconjecture is also proved since the number of pockets of primes in thestandard pockets of prime is infinite. (2)
Finding number of twin primes in each pocket of primes in the stan-dard pockets of primes and obtaining any general formula seems to bean interesting open problem. Algorithm to generate primes
To generate prime numbers to any given limit, the third method is thefastest and the best among the three methods that we have discussed. Here,we present an algorithm corresponding to the third method only that is basedon Theorems 3.5 and 3.6. It is easy to check whether a given natural number isprime or not by comparing with the list of primes already generated providedthe number is within the list.
Generating primes with [ M IpP k + 1 , M pP k ( M pP k + 4) + 3] , k ≥ .Algorithm: p = 2, p = 3, IpP = [2 , pP = { , } , π ( pP ) = 2, M IpP = 3 = M pP , j = 2, ( j = Number of primes already generated) x = 8, ( x = Number of pockets of primes that are to be considered) Do 10 k = 1 to x , IpP k +1 = [ M IpP k + 1 , M pP k ( M pP k + 4) + 3], IP k +1 = [ M IpP k + 2 , M pP k ( M pP k + 4) + 2], C ( IP k +1 ) = {} ,Do 20 i = 1 to j , Q i,k = j MpP k p i k , Q ′ i,k = j MpP k ( MpP k +4)+2 p i k , C i ( IP k +1 ) = { p i ( Q i,k + 1) , p i ( Q i,k + 2) , . . . , p i Q ′ i,k } ,20 C ( IP k +1 ) = C ( IP k +1 ) S C i ( IP k +1 ) pP k +1 = IP k +1 \ C ( IP k +1 ), ( C ( IP k ) = set of all composites in IP k .) π ( pP k +1 ) = | pP k +1 | , M pP k +1 = max pP k +1 , tpP k +1 = pP k +1 , (Here, tpP k +1 represents temporary pP k +1 .) y = j , j = j + π ( pP k +1 ), p j = M pP k +1 ,print ( k + 1, ′ th pocket of primes with No. of primes = ’, π ( pP k +1 ),’ starting with ’, y + 1, ′ th prime to ’, j , ′ th prime. They are’)print ( p y + l , l = 1 to π ( pP k +1 )),10 Print ( ′ M pP k +1 = ′ , p j , ′ = ′ , j, ′ th prime.’)EndIn the three methods that we have discussed so far, we could see that thevalues of π ( pP k ), in each method, play an important roll and thereby we definethe following. Definition 3.
The sequence π ( pP ) , π ( pP ) , . . . is called the sequence oforder of pockets of primes, pP , pP , . . . . Table 1 shows different sequences of order of pockets of primes in the threemethods up to k = 8 in the first method, k = 6 in the second and k = 4 inthe third. Remark 5.
A new study is needed on the behaviour of sequences of order ofpockets of primes in the three methods.
Remark 6.
While generating prime numbers using the above method, oneneed not start with
IpP = [2 , , pP = { , } , IpP = [4 , , . . . . If p , p , . . . , p k are already known primes, then by taking IpP = [ p , p k ] and pP = { p , p , . . . , p k } in the above method, one can generate primes by consideringsuccessive pockets of primes, pP j +1 , j = 1 , , . . . and k ≥ . Riemann zeta function and prime number generation
In this section, we relate prime number generation with Riemann zetafunction. Riemann zeta function ζ ( z ) [9] is given by ENERATING PRIMES - A FAST NEW METHOD 15
Table 1. π ( pP j ), order of prime pockets in the three Methods π ( pP j ) = n j n n n n n n n n Method 1 1 1 1 1 2 3 5 9Method 2 1 1 2 11 314 339730 −− −−
Method 3 2 7 105 32622 −− −− −− −− ζ ( z ) = z + z + z + z + . . . ,the series is convergent for Re ( z ) > Proposition 5.1. If (1 − p zk )(1 − p zk − ) . . . (1 − z )(1 − z ) ζ ( z ) = 1+ n z + n z + . . . and n > n > . . . , then p k +1 = n , p k +2 = n , . . . , p k + π ( pP k +1 ) = n π ( pP k +1 ) and p k +1 , p k +2 , . . . , p k + π ( pP k +1 ) ∈ pP k +1 = Φ([ p k + 1 , p k ( p k + 4) + 3]) where π ( pP k +1 ) = | pP k +1 | and Re ( z ) > , k ∈ N .Proof. For Re ( z ) >
1, we have ζ ( z ) = z + z + z + z + . . . .This implies, ζ ( z ) = 1 + z (1 + z + z + z + . . . ) + z + z + z + z + . . . . ⇒ (1 − z ) ζ ( z ) = 1 + z + z + z + z + . . . .= 1 + z + z + z + . . . - z (1 + z + z + z + . . . ).= 1+ sum of the terms of ζ ( z ) without multiples of z .Similarly, we get,(1 − z )(1 − z ) ζ ( z ) = 1 + z + z + z + z + z + z + z + . . . .= 1+ sum of the terms of ζ ( z ) without multiples of z or z .Continuing the above process and using Theorem 3.6, we get the result. (cid:3) Remark 7.
Number of primes in a pocket of primes plays an important rolein the process of generating primes from successive pockets of primes and alsomeasure the power/speed of the algorithm that generates primes. Legendre [11] obtained a formula to calculate π ( x ) , the number of primes ≤ x , x ∈ N .Based on this, we obtain, the number of primes in [ p k + 1 , p k ( p k + 4) + 3] , π ([ p k + 1 , p k ( p k + 4) + 3]) = π ( p k ( p k + 4) + 3) − π ( p k )= π ( p k ( p k + 4) + 3) − k , k ∈ N . Acknowledgement.
I express my sincere thanks to the Central Univer-sity of Kerala, Kasaragod, Kerala, India - 671 316 and St. Jude’s College(SJC), Thoothoor, Kanyakumari District, Tamil Nadu, India - 629 176 forproviding facilities to do this research work. I also express my sincere thanksto Prof. S. Krishnan (late) and Dr. V. Mohan, Department of Mathematics,Thiyagarayar College of Engineering, Madurai, Tamil Nadu, India - 625 015,Prof. M. I. Jinnah and Prof. L. John, Department of Mathematics and Mr.Albert Joseph, Assistant Registrar, University of Kerala, Trivandrum, Kerala,
India - 695 581 and Rev. Fr. J. G. Jesudas (late), Correspondent, Rev. Fr.C. M. George (late), Principal, Dr. K. Vareethaiah and Dr. S. Amirthayan,SJC, Thoothoor for their support and encouragement to do research.
References [1] M. Agarwal, N. Kayal and N. Saxena,
PRIMES is in P , Annals of Mathematics, (2004), 781–793.[2] M. Aigner and G. M. Ziegler, Proofs from the book , Springer, (4 th Ed.), 2010.[3] J. Bertrand,
Memoire sur le nombre de valeurs que peut prendre une fonction quandon y permute les lettres qu’elle renferme , Journal de l’Ecole Royale Polytechnique, vol. 18 (30) (1845), 123–140.[4] H. Cramer,
On the Order of Magnitude of the Difference Between Consecutive PrimeNumbers , Acta Arith. (1936), 23–46.[5] David Galvin, Erdos’ proof of Bertrand’s postulate , 2016. Online at http : .nd.edu/dgalvin /pdf/bertrand.pdf. [6] M. Deleglise and J. Rivat, Computing π ( x ) : The Meissel, Lehmer, Lagarias, Miller,Odlzko Method , Mathematics of Computing
65 (213) (1996), 235–245.[7] P. Erdos,
Beweis eines Satzes von Tschebyschef , Acta Sci. Math. (Szeged) (1930 -1932), 194–198.[8] J. Havil, Gamma: Exploring Eulers Constant , Princeton University Press, 2003.[9] Jean-Pierre Serre,
A course in arithmetic , Springer-Verlag New York, 1973.[10] J.C. Lagarias, V.S. Miller and A.M. Odlyzko,
Computing π ( x ) : The Meisser-Lahmermethod , Math. Com. (1985), 537–560.[11] D.H. Lehmer, On the exact number of primes less than a given limit , University ofCalifornia, Berkley, California, US (1959), 381–388.[12] S. Lou and Q. Yau,
A Chebyshevs Type of Prime Number Theorem in a Short Interval(II) , Hardy-Ramanujan J. (1992), 1–33.[13] E.D.F. Meissel, Ueber die Bestimmung der Primzahlenmenge innerhalb gegebenerGrenzen , Math. Ann. (1870), 636–642.[14] E.D.F. Meissel, Berechnung der Menge von Primzahlen, welche innerhalb der erstenHundert Millionen naturlicher Zahlen vorkommen , Math. Ann. (1871), 523–525.[15] E.D.F. Meissel, Ueber Primzahlmengen , Math. Ann. (1883), 304.[16] E.D.F. Meissel, Berechnung der Menge von Primzahlen, welche innerhalb der erstenHundert Milliarde naturlicher Zahlen vorkommen , Math. Ann. (1885), 251–257.[17] Meredith M. Paker, Biography of Paul Erdos and discussion of his proof of BertrandsPostulate . Online at https://meredithpaker.squarespace. com/s/Erdos-abff.pdf.[18] Poussin, C. de la Vallee,
Recherces analytiques sur la theorie des nombres premiers ,Ann. Soc. Sci. Bruxells, 1897.[19] P. Tchebychev,
Memoire sur les nombres premiers , Journal de mathematiques pureset appliquees, (1852), 371–382.[20] Thomas Koshy, Elementary Number Theory with Applications , Academic press, Cal-ifornia, USA, 2002.[21] Y. Zhang,
Bounded gaps between primes , Ann. Math.,
179 (3) (2014), 1121 - 1174.MR 3171761, doi:10.4007/annals.2014.179.3.7.
Department of Mathematics, Central University of Kerala, Tejaswini Hills,Periye - 671 316, Kasaragod, Kerala, India
E-mail address ::