<<

International Journal of and (ISSN: 2279 – 0764) Volume 06 – Issue 01, January 2017

New Formulas for Semi-Primes. Testing, and Identification of the nth and next Semi-Primes

Issam Kaddoura, Khadija Al-Akhrass Samih Abdul-Nabi Department of , school of arts and sciences Department of and communications engineering, Lebanese International University Lebanese International University Saida, Lebanon Beirut, Lebanon Email: Samih.abdulnabi [AT] liu.edu.lb

Abstract—In this paper we give a new semiprimality test and we Mathematicians have been interested in many aspects of the construct a new formula for  (2) ()N , the that counts the . In [5] authors derive a probabilistic of not exceeding a given number N . We also function gy() for a number y to be semiprime and an present new formulas to identify the nth semiprime and the next asymptotic formula for counting gy() when y is very large. semiprime to a given number. The new formulas are based on the In [6] authors are interested in factorizing semiprimes and use knowledge of the primes less than or equal to the roots of an approximation to  ()n the function that counts the NPPPN: , ....  3 . 12   3 N  numbers  n . While mathematicians have achieved many important Keywords-component; prime, semiprime, nth semiprime, next results concerning distribution of prime numbers, many are semiprime interested in semiprime properties as to counting prime and semiprime numbers not exceeding a given number. I. INTRODUCTION From [7, 8, 9], the formula for  (2) ()N that counts the Securing data remains a concern for every individual and semiprime numbers not exceeding N is given by (1). every organization on the globe. In telecommunication, is one of the studies that permit the secure   N  x transfer of information [1] over the Internet. Prime numbers (2) (Ni )   1 (1) have special properties that make them of fundamental   i1  importance in cryptography. The core of the Internet security is  based on protocols, such as SSL and TSL [2] released in 1994 This formula is based on the primes P , P , … and persist as the basis for securing different aspects of today's 1 2 Internet [3]. PN .   N  The Rivest-Shamir-Adleman method [4], released in 1978, uses asymmetric keys for exchanging data. A Our contribution is of several folds. First, we present a formula to test the semiprimality of a given , this secret key S and a public key P are generated by the k k (2) recipient with the following property: A message enciphered formula is used to build a new function  ()N that counts the semiprimes not exceeding a given integer N using by Pk can only be deciphered by Sk and vice versa. The only PPPN, ,....  3 . Second, we present an explicit public key is publicly transmitted to the sender and used to 12   3 N  encipher data that only the recipient can decipher. RSA is th based on generating two large prime numbers, say P and Q formula that identifies the n semiprime number. And finally and its security is enforced by the fact that albeit the fact that we give a formula that finds the next semiprime to any given number. the of these two primes n P Q is published, it is of enormous difficulty to factorize n . II. SEMIPRIMALITY TEST A semiprime or (2 prime) or (pq number) is a With the same complexity Ox() as the Sieve of that is a product of 2 primes not necessary distinct. The semiprime is either a of prime or square to test a primality of a given number x , we free. Also the square of any is a semiprime employ the Euclidean and the fact that every prime number. number greater than 3 has the form 61k  and without

www.ijcit.com 49

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 06 – Issue 01, January 2017 previous knowledge about any prime, we can test the primality By the fundamental of ,  a prime of x  8 using the following procedure: number p such that p divides a . That means p a3 N , Define the following functions but p divides a and a divides N , hence p divides N with the property pN 3 . 1 x x    x  x   (2) Tx0 ()          Lemma 1: tells that, if N is not divisible by any prime 2 2 2    3  3   pN 3 , then N has at most 2 prime factors, i.e., N is prime or semiprime . Using the proposed defined by x  Tx()we construct the semiprimality test as follows: 6 1 xx Tx() (3) For x  8 , define the functions Kx1() and Kx2 () as 1   x k1 6kk 1 6 1 follows:  6   3 x   1 xx Kx1() =  (7) 3  pp x  ()x i1 ii   6 1 xx Tx() (4)  3 x 2        x k1 6kk 1 6 1 1 x x x Kx2 () = 1 T  (8)  3    ()x i1 pi p i p i 6      Where  ()x is the classical prime counting function TTT0 1 2 Tx()  (5) presented in (6), Tx() is the same as in Theorem 1. Obviously 3 Tx() is independent of any previous knowledge of the prime Where x and x are the floor and the ceiling functions numbers. of the x respectively. Lemma 2: If Kx1( ) 0 , then x is divisible by some We have the following theorem which is analog to that prime px 3 . appeared in [10] with slight modification and the details of the i proof are exactly the same. xx Theorem 1: Given any positive integer x  7 , then Proof. For Kx1( ) 0 , we have 0 for some ppii 1. x is prime if and only if Tx( ) 1 3 pi , then x is divisible by pi for some pxi  . 2. x is composite if and only if Tx( ) 0 Lemma 3: If Kx( ) 1 ,then x has at most 2 prime 3. For x  7 1 factors exceeding 3 x .

xx75        xx 66    Proof. If Kx( ) 1 , then 1 for all  ()4x  T (6 j  7)  T (6 j  5) (6) 1   ppii jj11  3 counts the number of primes not exceeding x . pxi  therefore by Lemma 1: , x is not divisible by any Now we proof the following Lemma: 3 prime pi  x, therefore x has at most two prime factors Lemma 1: If N is a positive integer with at least 3 exceeding 3 x. factors, then there exists a prime p such that: Lemma 4: If Tx( ) 0 and Kx1( ) 1 , then x is pN 3 and p divides N semiprime and Kx2 ( ) 0 . Proof. If N has at least 3 factors then it can be represented Proof. If Kx( ) 1 , then x has at most 2 prime factors but as: N a.. b c with the assumption 1 abc   , we deduce 1 Tx( ) 0 which means that x is composite, hence x has 3 3 that Na or aN . exactly two prime factors and both factors are greater than

www.ijcit.com 50

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 06 – Issue 01, January 2017

 1. Tx( ) 0 and Kx1( ) 1 3 xx 3 x and  10  for each prime pxi  , ppii or therefore Kx( ) 0 . 2 2. Tx( ) 0 , Kx1( ) 0 and Kx2 ( ) 1

Lemma 5: If Tx( ) 0 and Kx1( ) 0 , then x is a Proof. If x is semiprime, then x pq where p and q are semiprime number if and only if Kx2 ( ) 1 . two primes. If p and q both are greater than 3 x then Tx( ) 0 and

 3 pq   3  1 pq pq  pq  K( pq )       1 1      33pq i1 ppii  pq        

if x p q where p' and q ' are two primes such that px'  3 and qx'  3 then Tx( ) 0 and  

3  pq'' 1p ' q ' p ' q ' K1( p ' q ')   0 3  pp''  pq'' i1   pq''''p q because 0 and pp'' Figure 1: MATLAB code for the computation of K1 and K2  3 pq''  1p ' q ' p ' q '   p ' q '  K2 ( p ' q ')   1 T   1 3  p''' p p Proof. If Tx( ) 0 and Kx( ) 0 then x divides a  pq'' i1     1  prime pN 3 , but x is semiprime that means x pq and q p'''''' q p q p q because  1(T )  q '  q '1(')1.  T q  is prime number hence for prime ppi  and x pq we have:   p''' p p     x x   x   pq pq     pq   The converse can be proved by the same arguments.   1TT      1  1 p p p p p   p  i i     i          Corollary 1 A positive integer x  7 is Consequently, Kx( ) 1 because at least one of the terms semiprime if and only if 2 K( x ) K ( x )  T ( x )  1. is not zero. 12 Proof. A direct consequence of the previous theorem and x x     x   Conversely, if Kx2 ( ) 1 then 1 T is not lemmas.     pi p i     p i   x III. SEMIPRIME COUNTING FUNCTION zero for some i and then x p q and T  1for some i  pi

pq Notice that the triple (T ( x ), K12 ( x ), K ( x )) have only the prime px 3 then Ti  T( q ) 1 hence q is a prime i  following 4 possible cases only: pi number and x is a semiprime number. Case 1. (T ( x ), K12 ( x ), K ( x )) (1,1,0) indicates that Figure 1 shows the MATLAB code for the computation of x is prime number. and . Case 2. (T ( x ), K12 ( x ), K ( x )) (0,1,0) indicates that We are now in a position to prove the following theorem x is semiprime in the form x pq where p and that characterizes the semiprime numbers. are primes that 3 x  p 2 x  and q     Theorem 2: (Semiprimality Test): Given any qx 2 . positive integer x  7 , then x is semiprime if  and only if:

www.ijcit.com 51

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 06 – Issue 01, January 2017

Case 3. (T ( x ), K ( x ), K ( x )) (0,0,1) indicates that th 12 Knowing that the bound of the n prime is Pn  2 n log n x is semiprime in the form x pq where p and th [11], we can say that the n semiprime spn  2 q are primes such that px 3 and  Pn  4 n log n . xx qx   3 2 . Theorem 4: For x  8 and n  2 , sp the nth 3  n p x semiprime is given by the formula:

Case 4. (T ( x ), K12 ( x ), K ( x )) (0,0,0) indicates that  4n ln n 22nn  4 n ln n   x has at least 3 prime factors . sp 88     n nx1 (2) ( ) x xx88n3  K ( m )  K ( m )  T ( m ) Using the previous observations, lemmas as well as  12  m8 Theorem 2: and corollary, we prove the following theorem that includes a function that counts all semiprimes not exceeding a given number N . The formula in full is given by:

 Theorem 3: For N  8 then,   4nn ln  N 2n spn 8  33    (2) x8 x mm      ()2N  (() K x  K () x  T ()) x (9) 11m  m   m  m    m   12 n3           1  T  T ( m ) 33  p p    p p p m8mm  i  1i  i    i  1  i  i    i  x8  is a function that counts all semiprimes not exceeding N . Figure 2 shows the MATLAB code for  2 2 computation. where Tm() is given by

T0()()() m T 1 m T 2 m Tm( )  3

    mm          66    1 1m m    m  m   1   m  m     1    m  m                                322233      mm kk11  6161k  k       6161 k   k     %         66              th (2) Proof. For the n semiprime spn ,  ()spn  n and (2) (2) for x spi , pi( x ) pi ( spi )  i  i  1,2,3,...., n . Using the properties of the function

2n 1 xn G(,) n x  Figure 2: MATLAB code for nx1 0 xn

we compute th IV. N SEMIPRIME FORMULA 4nn ln   4 ln  2n (2) 8(2)  8  G ( n , ( x )) xx88%nx 1 ( ) The first few semiprimes in ascending are 8 G ( n ,(2) (8))  G ( n , (2) (9)) (2) (2) sp14, sp 2  6, sp 3  9, sp 4  10, sp 5  14, sp 6  15, sp 7  21, G( n , (10))  ...  G ( n , ( Pn1 ))  .... (2) etc. G( n , ( Pn1 1)) ...... G ( n ,(2) ( P )  G ( n , (2) ( P  1)  ... 2n nn We define the function where 8  1  1  1  ...1  0 0  0  ...  sp G(,) n x   n nx1 n  1,2,3... and x  0,1,2,3... where the last 1 in the is the value of clearly (2) G( n , ( spn1 )) and then followed by (2) 2n 1 xn G( n , ( spn ) G ( n , n ) 0 followed by zeroes for the rest G(,) n x  terms of the summation, hence nx1 0 xn 4n ln n   4 n ln n  2 2n spn 8  G ( n , ( x ))  8  (2) xx88nx1 ( )

www.ijcit.com 52

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 06 – Issue 01, January 2017

As an example, computing the 5th semiprime number gives

sp5 8  1  1  1  1  1  1  14 as shown in Table 1. Now we introduce an algorithm that computes the next semiprime to any given positive integer N .  2 (8) 2 G(5, 2 (8)) 1 Theorem 5: If N is any positive integer greater 2 2  (9) 3 G(5, (9)) 1 than 8 then the next semiprime to is given by: 2 2  (10) 4 G(5, (10)) 1 N x N i  (10) 2 2 NextSP( N ) N  1   1  T ( x )  K12 ( x )  K ( x )  (11) 4 G(5, (11)) 1 i1 xN1  2 (12) 4 G(5, 2 (12)) 1 where T( x ), K12 ( x ), K ( x ) are the functions defined in Section  2 (13) 4 G(5, 2 (13)) 1 2.  2 (14) 5 G(5, 2 (14)) 0 Proof. We compute the summation: Table 1: Computing the 5th semiprime N x N i (1T ( x )  K ( x )  K ( x ))  12 Figure 3 shows the MATLAB code for the nth semiprime i1 xN1 computation. NextSP( N ) N 1x N i (1 T ( x )  K ( x )  K ( x ))    12 i1 xN1 N x N i (1T ( x )  K ( x )  K ( x ))   12 i NextSP() N N xN1 NextP( N ) N 1 N (1) (0) i1 i  NextP ( N )  N  NextSPNN( ) 1 hense

N x N i  NextSP() N N  1  (1()  T x  K12 () x  K ()) x i1 xN1

x  2 ()x Time in seconds 10 4 0.00 100 34 0.01 1000 299 0.1 10000 2625 3.0 100000 23378 50 1000000 210035 1091 Figure 3: MATLAB code for sp 10000000 1904324 22333 n 100000000 17427258 508840

Table 2: Testing on  (2)()x

V. NEXT SEMIPRINE

VI. RESULTS In our previous work [10], we introduced a formula that finds the next prime to a given number. In this section, we use an enhancement formula to find the next prime to a given We implemented the proposed functions using MATLAB number and we introduce a formula to compute the next and complete the testing on an Intel Core i7-6700K with 8M semiprime to any given number. cache and a clock speed of 4.0GHz. Table 2 shows the results related to  2 ()x for some selected values of x . Recall that the integer x  8 is a semiprime number if and th only if K12( x ) K ( x )  T ( x )  1 and if x is not semiprime We have also computed few n semiprimes as shown in then K12( x ) K ( x )  T ( x )  0 . Table 3.

www.ijcit.com 53

International Journal of Computer and Information Technology (ISSN: 2279 – 0764) Volume 06 – Issue 01, January 2017

knowing only the primes that are less or equal 3 n while existing formulas require at least knowing the primes that are n spn Time in seconds 2 100 314 0.07 less or equal n . We also present a new formula to identify 200 669 0.24 the nth semiprime and finally, a new formula that gives the 300 1003 0.49 next semiprime to any integer. 400 1355 0.86 500 1735 1.22 REFERENCES 600 2098 1.89 [1] “Standard specifications for public key cryptography (p1363),” pp. 367– 700 2474 2.39 389, 1998. [Online]. Available: http://grouper.ieee.org/groups/1363/ 800 2866 3.40 [2] E. Rescorla, SSL and TLS: designing and building secure systems. 900 3202 3.78 Addison-Wesley Reading, 2001, vol. 1. 1000 3595 4.91 [3] J. Clark and P. C. van Oorschot, “Sok: Ssl and https: Revisiting past 5000 19643 105.72 challenges and evaluating certificate trust model enhancements,” in Security and Privacy (SP), 2013 IEEE Symposium on. IEEE, 2013, pp. 10000 40882 579.01 511–525. th Table 3: Testing on n semiprimes [4] R. L. Rivest, A. Shamir, and L. Adleman, “A method for obtaining digital signatures and public-key cryptosystems,” Communications of the ACM, vol. 21, no. 2, pp. 120–126, 1978. And finally we show the next semiprimes to some selected [5] S. Ishmukhametov and F. F. Sharifullina, “On a distrubution of in Table 4. semiprime numbers,” Izvestiya Vysshikh Uchebnykh Zavedenii. Matematika, no. 8, pp. 53–59, 2014. [6] R. Doss, “An approximation for euler phi,” Northcentral University Prescott Valley, United States o, 2013. NextSP() n Time in seconds [7] E. W. Weisstein, “Semiprime,” Wolfram Research, Inc., 2003. 100 106 0.01 [8] J. H. Conway, H. Dietrich, and E. A. Brien, “Counting groups: gnus, 200 201 0.02 moas and other exotica,” Math. Intelligencer, vol. 30, no. 2, pp. 6–15, 300 301 0.04 2008. 400 403 0.07 [9] D. A. Goldston, S. Graham, J. Pintz, and C. Y. Yildirim, “Small gaps between primes or almost primes,” Transactions of the American 500 501 0.09 Mathematical Society, pp. 5285–5330, 2009. 1000 1003 0.31 [10] I. Kaddoura and S. Abdul-Nabi, “On formula to compute primes and the 5000 5001 5.92 nth prime,” Applied Mathematical Sciences, vol. 6, no. 76, pp. 3751– 10000 10001 22.38 3757, 2012. Table 4: Testing on NextSP() n semiprimes [11] G. Robin, “Estimation de la fonction de tchebychef Ө sur le k-ième nombre premier et grandes valeurs de la fonction w(n) nombre de diviseurs premiers de n,” Acta Arithmetica, vol. 42, no. 4, pp. 367–389, VII. CONCLUSION 1983. In this work, we presented new formulas for semiprimes. First,  (2) ()n that counts the number of semiprimes not exceeding a given number n . Our proposed formula requires

www.ijcit.com 54