Applied Mathematical cieces, Vol., 0, o., 35-35 O Formula to Compute Primes ad the th Prime Issam Kaddoura Lebaese Iteratioal Uiversity Faculty of Arts ad cieces, Lebao issam.kaddoura@liu.edu.lb amih Abdul-Nabi Lebaese Iteratioal Uiversity chool of Egieerig, Lebao samih.abdulabi@liu.edu.lb Abstract I this paper, we propose a ew primality test, ad the we employ this test to fid a formula for π that computes the umber of primes withi ay iterval. We fially propose a ew formula that computes the th prime umber as well as the et prime for ay give umber. Keywords: prime, cogruece, primality test, Euclidea algorithm, sieve of Eratosthees. Itroductio ice Euclid [], primes ad prime geeratio were a challege of iterest for umber theory researchers. Primes are used i may fields, oe ust eed to metio for eample the importace of primes i etworkig ad certificate geeratio []. ecurig commuicatio betwee two devices is achieved usig primes sice primes are the hardest to decipher [5]. The search for prime umbers is a cotiuous task for researchers. ome like [4] are lookig for twi primes others like [] are lookig for large scaled prime umbers. The prime coutig fuctio is a fuctio that gives the umber of primes that are less tha or equal to a give umber. May like [] ad others have preseted the formula to compute the umber of primes betwee ad a give iteger.
35 I. Kaddoura ad. Abdul-Nabi This paper is divided as follow: i sectio we preset the primality test. I sectio 3, we itroduce the prime coutig fuctio that we will use i sectio 5 to fid the et prime to ay give umber. I sectio 4, we coduct some results ad build the th prime fuctio. I sectio, we will use the primality test to compare our results with some recet results i the literature ad coclude this paper.. Primality test I the paper, we employ the Euclidia algorithm, ieve of Eratosthees ad the fact that every prime is of the form k±where k a iteger. Let be a real umber, the floor of, deoted by is the largest iteger that is less or equal to. To test the primality of it is eough to test the divisibility of by all primes. Let be of the form. k k k imilarly, let be of the form k k k. Theorem : If is ay iteger such that g.c.d, ad, the i is prime if ad oly if ii is composite if ad oly if 0 < Proof: is prime gcd, i i / 0 mod i i, k k k withi the rage of the summatio i the k k
O formula to compute primes 353 formulas of ad. k imilarly ad cosequetly The proof of the secod part of the theorem is obvious. 3. Prime Coutig Fuctio The prime coutig fuctio, deoted by the Greek letter π, is the umber of primes less tha or equal to a give umber. Computig the primes is oe of the most fudametal problems i umber theory. You ca see [0] for the latest works regardig prime coutig fuctios. Usig the previous primality test, we defie the followig ew form of the prime coutig fuctio π. Recall that if i is prime i 3. 0 if i is composite The i couts the primes betwee m ad where m. im Ad we ca write a formula for π as follows : π 4 i 3. i The size of this summatio ca be dramatically reduced by cosiderig oly i of the form 5 or. π 4 3.3 Thus the followig theorem is already proved. Theorem 5:, π gives the umber of primes. 4. The th Prime Fuctio We are ow ready to itroduce our ew formula to fid the th prime. The th prime umber is deoted by p with p, p 3, p 3 5 ad so o. First we itroduce f as follows
354 I. Kaddoura ad. Abdul-Nabi f For,, 3 ad 0,,... 4. Or f For,, 3 ad 0,,... 4. These fuctios have the property that < for for f 0 4.3 It is well kow that P ; see [8] ad [] for more details. Usig the followig formula combied with the above formula for π f P π 4.4 We use f as i 4. to obtai the followig formula for th prime i full: 4 P 4 3 P 4.5 Or usig f as i 4. to obtai the formula for th prime i full: 5 P π 4. These formulas are i terms of aloe ad we do ot eed to kow ay of the previous primes. ee [] for formulas of the same ature.
O formula to compute primes 355 The Wolfram Mathematica implemetatio of P as i 4.5 is as follow: A[_] : -/Floor[Floor[qrt[]]/] * um[floor[floor[/ k ] - / k ], {k,, Floor[Floor[qrt[]]/] }] B[_] : -/Floor[Floor[qrt[]]/] * um[floor[floor[/ k - ] - / k - ], {k,, Floor[Floor[qrt[]]/] }] [_] : A[] B[]/ PN[_] : 4 um[floor[[ ]], {,, Floor[ - /]}] um[floor[[ - ]], {,, Floor[ /]}] PT[_] : 3 Floor[*Log[]] - um[floor[/*4 um[floor[[ ]], {,, Floor[i - /]}] um[floor[[ - ]], {,, Floor[i /]}]], {i,, Floor[*Log[]] }] 5. Net Prime The fuctio etp fids the first prime umber that is greater tha a give umber. As i [9] ad usig as defied i sectio, it is clear that: ad i i ow cosider the summatio i i etp i etp 0 i such that etp i etp i i i 0 etp i fially we obtai etp i etp etp 5. i We used the proposed primality test to implemet etp as follow: et k m k m et 3 If the go to step 8 4 et m k 5 5 If m the go to step 8 k k Go to step 8 Output the value of m
35 I. Kaddoura ad. Abdul-Nabi The Wolfram Mathematica implemetatio of etp is as follow: A[_] : -/Floor[Floor[qrt[]]/] * um[floor[floor[/ k ] - / k ], {k,, Floor[Floor[qrt[]]/] }] B[_] : -/Floor[Floor[qrt[]]/] * um[floor[floor[/ k - ] - / k - ], {k,, Floor[Floor[qrt[]]/] }] [_] : A[] B[]/ Iput["Iput a umber:"]; kceilig[-/]; m0; While[True, mk; If[[m],Break[]]; mk5; If[[m],Break[]]; kk;]. Eperimetal Results th prime P Value 50 4.s 9 00 5.58s 54 00.9s 3 50 8.4s 583 Table : th prime We implemeted our algorithm usig Wolfram Mathematica versio 8. Table shows the results for the th prime while table shows the results for the et prime. Those eperimetal results show the compleity of our primality test Net prime Net to etp Value 0^8 0.04s 0000000 0^9 0.8s 00000000 0^0.0s 000000009 0^.0s 00000000003 0^ 43.8s 000000000039 0^3 3.4 000000000003 Table : Net prime
O formula to compute primes 35 Refereces [] ANI. ANI X9.3-998: Digital igatures usig Reversible Public Key Cryptography for the Fiacial ervices Idustry. Appedi A, America Natioal tadards Istitute, 998 [] C. P. Willas, O Formulae for the th Prime Number, The Mathematical Gazette, Vol. 48, No. 3, December, 94, 43-45 [3] E.. Rowlad, A Natural Prime-Geeratig Recurrece, Joural of Iteger equeces, Vol., 008, Article 08..8 [4] G. Teebaum, ad M.M. Frace, The prime umbers ad their distributio. Providece, America Mathematical ociety. RI, 000. [5] IEEE. IEEE P33: tadard pecificatios for Public Key Cryptography. IEEE P33a D, Amedmet : Additioal Techiques. December, 00. [] M. Deléglise ad J. Rivet. Computig π: The Meissel, Lehmer, Lagarias, Miller, Odlyzko Method. Mathematics of computig. Vol. 5, 99, 35-45 [] M. Joye, P. Paillier ad. Vaudeay. Efficiet Geeratio of Prime Numbers, vol. 95 of Lecture Notes i Computer ciece, 000, 340-354, priger-verlag. [8]. M. Ruiz, Applicatios of maradache Fuctios ad Prime ad Coprime Fuctios, America Research Press, Rehoboth, 00. [9]. M. Ruiz, The geeral term of the prime umber sequece ad the maradache Prime Fuctio, maradache Notios Joural 000 59. [0] T. Oliveira e ilva, Computig π: The combiatorial method. Revista do Detua, vol. 4,, march 00 [] V.. Igumov, Geeratio of the large radom prime umbers. Tomsk tate Uiversity Russia. Electro Devices ad Materials. 004, - 8 [] W. Narkiewicz, The developmet of prime umber theory: from Euclid to Hardy ad Littlewood, priger Moographs i Mathematics, Berli, New York: priger-verlag, 000 Received: February, 0