EUROPEAN JOURNAL OF PURE AND APPLIED MATHEMATICS Vol. 17, No. 2, 2024, 1146-1154 ISSN 1307-5543 – ejpam.com Published by New York Business Global On Prime Counting Functions Using Odd K-Almost Primes T. Rashid1,2, M. M. M. Jaradat3,∗, E. Yolacan4, H. Ahmad5 1 Department of Mathematical Sciences, IUST, Awantipora, India, 192122 2 Department of Applied Sciences and Humanities, SVKM’s, NMIMS, Mukesh Patel School of Technology Management and Engineering, Shirpur, India 3 Mathematics Program, Department of Mathematics and Statistics, College of Arts and Sciences, Qatar University, 2723, Doha, Qatar 4 Department of Airframe and Powerplant Maintenance, School of Applied Sciences, Cappadocia University, Mustafapasa Campus, Ürgüp Nevsehir, Turkey 5 Near East University, Operational Research Center in Healthcare, Near East Boulevard, PC: 99138 Nicosia/Mersin 10, Turkey Abstract. This work takes an interesting diversion, revealing the extraordinary capacity to de- termine the precise number of primes in a space tripled over another. Exploring the domain of K-almost prime numbers, this paper provides a clear explanation of the complex idea. In addi- tion to outlining the conditions under which odd K-almost prime numbers must exist, it presents a novel method for figuring out how often odd numbers are as 2-almost prime, 3-almost prime, 4-almost prime, and so on, up to a specified limit n. The work goes one step further and offers useful advice on how to use these approaches to precisely calculate the prime counting function, π(n). Essentially, it offers a comprehensive exploration of the mathematical fabric, where primes reveal their mysteries in both large and small spaces. 2020 Mathematics Subject Classifications: 11Y16, 11Y11,11Y40 Key Words and Phrases: Prime counting function, odd K-almost primes 1. Introduction Greek mathematicians were the first to study prime numbers and their characteristics in depth. Several significant primes-related findings had been established by the time Euclid’s Elements, which was written around 300 BC. One of the numerous unresolved issues in number theory is the prime calculating function π(n) (number of primes ≤ n). The prime counting function can be expressed by Legendre’s formula, Lehmer’s formula, ∗Corresponding author. DOI: https://doi.org/10.29020/nybg.ejpam.v17i2.4961 Email addresses: mmjst4@qu.edu.qa ( M. M. M. Jaradat), tawseefrashid123@gmail.com (T. Rashid), yolacanesra@gmail.com (E. Yolacan) , hijaz555@gmail.com ( H. Ahmad) https://www.ejpam.com 1146 © 2024 EJPAM All rights reserved. M. M. M. Jaradat et al. / Eur. J. Pure Appl. Math, 17 (2) (2024), 1146-1154 1147 Mapes’ method, or Meissel’s formula. The prime counting function has a large body of lit- erature. Different mathematicians made several attempts at the prime counting function by using analytic and algebriac approaches like [1–7, 9–12]. No one provided the precise result using any of these methods, which is a common problem. On the other hand, if a number is the product of exactly k prime numbers, that are the same or distinct, it is said to be k-almost prime. The ”1-almost prime” numbers are equiv- alent to the primes, whereas the ”2-almost prime” numbers are equivalent to semiprimes. These numbers are referred to as primes, biprimes, triprimes, etc. by Conway et al. [8]. The formulas for the number of K-almost-primes less than or equal to n are listed below. π(2)(n) = π(n 1 2 )∑ i=1 [ π( n pi )− i+ 1 ] , (1) π(3)(n) = π(n 1 3 )∑ i=1 π( n pi ) 1 2∑ j=1 [ π( n pipj )− j + 1 ] , (2) π(4)(n) = π(n 1 4 )∑ i=1 π( n pi ) 1 3∑ j=1 π( n pipj ) 1 2∑ k=j [ π( n pipjpk )− k + 1 ] (3) and so forth, where pn is the nth prime. π(x) is the prime counting function and π(t)(n) denotes t-almost prime function. Noel, Panos, and Wilson separately introduced these formulations for the first time in 2006. The problem with the calculations above is that they count both even and odd k-almost primes that are less than or equal to n and require the list of primes up to n 2 . This paper’s main goal is to locate the odd k-almost primes, which requires a prime list up to n 3 , which is a much smaller interval than n 2 . 2. Main Result Before proceeding, it is worth mentioning that we have used the following notations. 1. π(n) denotes the number of primes ≤ n. 2. Π(n) denotes the number of odd primes ≤ n. Clearly, for any n Π(n) = π(n)− 1. (4) 3. Πm(n) denotes the number of odd primes ≥ m and ≤ n. Clearly, Πm(n) = π(n)− π(m) + 1, if m is odd prime M. M. M. Jaradat et al. / Eur. J. Pure Appl. Math, 17 (2) (2024), 1146-1154 1148 = π(n)− π(m), otherwise 4. Π(K)(n) denotes the number of odd K- almost primes ≤ n. We can determine the number of 2-almost primes, 3-almost primes, 4-almost primes, etc., using equations (1),(2) and (3). These almost prime numbers fall into the even and odd categories. In this article, we only focus on odd almost primes, as every odd composite number is an odd K- almost prime. First, we talk about the circumstances in which an odd K-almost prime ≤ n exists for any n. The prerequisite is that (n) 1 K ≥ 3. For instance, if n = 100, then 100 1 2 , 100 1 3 , 100 1 4 are ≥ 3 but 100 1 5 < 3. Thus, upto 100, there are odd 2-almost primes, 3-almost primes, 4-almost primes but not odd 5-almost primes and higher. Every odd composite number, according to the Fundamental Theorem of Arithmetic, is actually an odd K-almost prime. For any natural number n, we know that there are even numbers that are n 2 (if n is even) and n−1 2 (if n is odd). The other odd numbers are prime and composite. Every odd composite is an odd K-almost prime, as we noted before. Thus, we can get the exact value of π(n) by deducting the number of even numbers and K-almost primes from the number n. Theorem 1. For any natural number n, the number of odd 2-almost primes is given by Π(2)(n) = t∑ i=1 Π( n pi+1 )− t(t− 1) 2 , (5) where t = Π(n 1 2 ) and pi the ith prime number. Proof. We will prove the formula (5) in two different ways. The sieve method is used to obtain the ist proof of the formula (5). For any natural number n, let u be an odd 2-almost primes ≤ n. Then u = pq, where p, q are odd prime numbers. In the beginning, we set p = 3 and change q from 3, 5, 7, ... up to the prime z such that z ≤ n 3 . Following that, Π(n3 ) gives the total number of odd 2-almost primes whose only factor is 3. Now, we fix p = 5 and vary q from 3, 5, 7, ... up to the prime ≤ n 5 . Then the number of odd 2-almost primes whose one factor is 5 is given by Π(n5 ). Continue the procedure until the prime pi such that n pi+1 < 3. Following the addition of all the odd 2-almost primes so obtained and the subtraction of the quantity of repeated M. M. M. Jaradat et al. / Eur. J. Pure Appl. Math, 17 (2) (2024), 1146-1154 1149 ones, we arrive at the formula (5). It should be noted that using the method described above, it is simple to infer that for any natural integer n, Π(2)(n) = π(2)(n)− π( n 2 ). (6) The second proof approach is as follows. Using (1). π(2)(n) = π(n 1 2 )∑ i=1 [ π( n pi )− i+ 1 ] = r∑ i=1 [ π( n pi )− i+ 1 ] , where r = π(n 1 2 ) = r∑ i=1 π( n pi )− r∑ i=1 i+ r∑ i=1 1 = r∑ i=1 π( n pi )− r(r − 1) 2 . Now, let Π(n 1 2 ) = t, then clearly by (4), r = t+ 1. Using this value in above equation we get, π(2)(n) = t+1∑ i=1 π( n pi )− t(t+ 1) 2 = t+1∑ i=1 [Π( n pi ) + 1]− t(t+ 1) 2 , ∵ (4) = t+1∑ i=1 Π( n pi ) + (t+ 1)− t(t+ 1) 2 , = t+1∑ i=1 Π( n pi ) + (t+ 1)(2− t) 2 (7) Using (7) in (6), we get Π(2)(n) = t+1∑ i=1 Π( n pi ) + (t+ 1)(2− t) 2 − π( n 2 ), = Π( n p1 ) + t+1∑ i=2 Π( n pi ) + (t+ 1)(2− t) 2 − π( n 2 ), M. M. M. Jaradat et al. / Eur. J. Pure Appl. Math, 17 (2) (2024), 1146-1154 1150 = π( n p1 )− 1 + t+1∑ i=2 Π( n pi ) + (t+ 1)(2− t) 2 − π( n 2 ), ∵ (4) = t+1∑ i=2 Π( n pi ) + (t+ 1)(2− t) 2 − 1, ∵ p1 = 2 = t+1∑ i=2 Π( n pi )− t(t− 1) 2 , = t∑ i=1 Π( n pi+1 )− t(t− 1) 2 . It proves the result. Note : It is important to note that formula (5) is superior to formula (1) in two ways: first, because (5) only produces odd 2-almost primes, and second, because (1) requires the list of primes up to n 2 , whereas (5) only needs the list up to n 3 , which is a very short interval. We offer a few straightforward examples to demonstrate our methodology. Example 1. Find the number of odd 2-almost primes upto 100, i.e., Π(2)(100). We know that Π(2)(n) = t∑ i=1 Π( n pi+1 )− t(t− 1) 2 . Here, n = 100 and t = Π(100 1 2 ) = Π(10) = 3 Now, Π( n p2 ) = Π(1003 ) = Π(33.3) = 10. Π( n p3 ) = Π(1005 ) = Π(20) = 7. Π( n p4 ) = Π(1007 ) = Π(14.2) = 5. Substitute the value’s in above equation to get Π(2)(100) = 10 + 7 + 5− 3 = 19. Example 2. Find the number of odd 2-almost primes upto 200, i.e., Π(2)(200). We know that Π(2)(n) = t∑ i=1 Π( n pi+1 )− t(t− 1) 2 . M. M. M. Jaradat et al. / Eur. J. Pure Appl. Math, 17 (2) (2024), 1146-1154 1151 Here, n = 200 and t = Π(200 1 2 ) = Π(14.14) = 5 ∴ Π(2)(200) = 5∑ i=1 Π( 200 pi+1 )− 10, = Π( 200 3 ) + Π( 200 5 ) + Π( 200 7 ) + Π( 200 11 ) + Π( 200 13 )− 10, = 17 + 11 + 8 + 6 + 5− 10, = 37. Number of odd 3-almost primes ≤ n, i.e.,Π(3)(n). In this section, we give the formula for finding the number of odd 3-almost primes ≤ n. Theorem 2. For any natural number n, the number of odd 3-almost primes is given by Π3(n) = s−1∑ j=2 [ t∑ i=1 Πpj ( n pjpi+j−1 )− t(t− 1) 2 ] (8) where t = Πpj [( n pj ) 1 2 ], s is the least value for which t = 0, ΠK(n) is the number of primes ≥ K and ≤ n and pj is the jth prime. Proof. The proof of (8) can be easily verified by following the procedure in the proof of formula (5). Note : It should be noted that formula (8) gives the number of only odd 3-almost primes and requires list of primes upto n 9 to find value of Π3(n), which is a very short interval. Example 3. Find the number of odd 3-almost primes up to 1000, i.e., Π(3)(1000). We know that, Π3(n) = s−1∑ j=2 [ t∑ i=1 Πpj ( n pjpi+j−1 )− t(t− 1) 2 ] . Here n = 1000. The prerequisite here is only the list of primes ≤ 111. For j = 2, t = Π3[( 1000 3 ) 1 2 ] = Π3(18.2) = 6. j = 3, t = Π5[( 1000 5 ) 1 2 ] = Π5(14.14) = 4. j = 4, t = Π7[( 1000 7 ) 1 2 ] = Π7(11.9) = 2. M. M. M. Jaradat et al. / Eur. J. Pure Appl. Math, 17 (2) (2024), 1146-1154 1152 j = 5, t = Π11[( 1000 11 ) 1 2 ] = Π11(9.5) = 0. Thus, s = 5. ∴ Π(3)(1000) = 4∑ j=2 [ t∑ i=1 Πpj ( n pjpi+j−1 )− t(t− 1) 2 ] = [ 6∑ i=1 Πp2( n p2pi+1 )− 6.5 2 ] + [ 4∑ i=1 Πp3( n p3pi+2 )− 4.3 2 ] + [ 2∑ i=1 Πp4( n p4pi+3 )− 2.1 2 ] = [ 6∑ i=1 Π3( 333.3 pi+1 )− 15 ] + [ 4∑ i=1 Π5( 200 pi+2 )− 6 ] + [ 2∑ i=1 Π7( 142.8 pi+3 )− 1 ] = 94. Number of odd 4-almost primes ≤ n, i.e.,Π(4)(n). In this section, we give the formula for finding the number of odd 4-almost primes ≤ n. Theorem 3. For any natural number n, the number of odd 4-almost primes is given by Π4(n) = l−1∑ k=2 [m−1∑ j=k [ t∑ i=1 Πpj ( n pkpjpi+j−1 )− t(t− 1) 2 ]] (9) where t = Πpj [( n pkpj ) 1 2 ], l is the least value for which Πpl [( n 3pl ) 1 2 ] = 0, m is the least value for which Πpm [( n pm ) 1 2 ] = 0, ΠK(n) is the number of primes ≥ K and ≤ n and pj is the jth prime. Proof. The proof of (9) can be easily verified by following the procedure in the proof of formula (5) and (8). Note : It is important noting that formula (9) gives the number of only odd 4-almost primes and requires list of primes up to n 27 , to find value of Π4(n), which is a very short interval. Prime counting function using odd K-almost primes So far, we have discussed oddK-almost primes and construction of formula’s for getting their number. Using that, the prime counting function for any n can be given by π(n) = n− (number of even’s ≤ n)− (number of odd K-almost prime’s ≤ n. Remember that 2 is even but prime, while 1 is odd but not prime. REFERENCES 1153 Example 4. Find the number of primes ≤ 100. Here the prerequisite is only the list of primes ≤ 33. Since up to 100 there are 50 even numbers, 19 odd 2-almost primes, 5 odd 3-almost primes and only 1 odd 4-almost prime. Hence, π(100) = 100− 50− (19 + 5 + 1) = 25. It is the exact number of primes ≤ 100. 3. Conclusions An extensive examination of the idea of K-almost prime numbers is provided in this article. It demonstrates the essential circumstances for odd K-almost prime numbers to exist and creates a formula for counting these numbers up to a certain limit while taking different values of K into consideration. The precise determination of the prime counting function, π(n), further illustrates the practical applicability of these procedures. This paper makes a significant contribution to the subject by demonstrating the viability of estimating the precise number of primes within a period three times the length of another interval, based on a given set of primes. Our understanding of prime numbers and their distribution is improved by the conclusions reported here, which also may have consequences for numerous mathematics and computational References [1] T.W. Ching. Lagrange’s equation with one prime and three almost-primes. Journal of Number Theory, 183:442–465, 2018. [2] T.W. Ching. Lagrange’s equation with almost-prime variables. Trans. Amer. Math. Soc., 375:7669–7714, 2022. [3] E.M. Wright G.H. Hardy. An introduction to the theory of numbers. 5th Ed. Oxford, England: Clarendon Press, 1979. [4] J. Havil. Gamma: Exploring euler’s constant. princeton. NJ: Princeton University Press, pages 164–188, 2003. [5] A. Odlyzko J. Lagarias. Computing π(x): An analytic method. J. Algorithms, 8:173– 191, 1987. [6] A. Odlyzko J. Lagarias, V.S. Miller. Computing π(x): The meissel-lehmer method. Math. Comput., 44:537–560, 1985. [7] L. Schoenfeld J.B. Rosser. Approximate formulas for some functions of prime num- bers. Illinois J. Math., 6:64–97, 1962. [8] E.A. O’Brien J.H. Conway, H. Dietrich. Counting groups: Gnus, moas and other exotica. Math. Intell., 30:6–18, 2008. REFERENCES 1154 [9] L. Locker-Ernst. Bemerkung über die verteilung der primzahlen. Elemente Math., 14:1–5, 1959. [10] M.P. May. Relationship between the prime-counting function and a unique prime number sequence. Missouri J. Math. Sci., 35(1):105–116, 2023. [11] B. Kane S. Banerjee. Finiteness theorems for universal sums of squares of almost primes. Journal of Number Theory, 212:233–264, 2020. [12] F.F. Sharifullina S.T. Ishmukhametov. On distribution of semiprime numbers. Rus- sian Mathematics, 58(8):43–48, 2014.