VOOZH about

URL: https://www.geeksforgeeks.org/dsa/hardy-ramanujan-theorem/

⇱ Hardy-Ramanujan Theorem - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Hardy-Ramanujan Theorem

Last Updated : 14 Feb, 2023

Hardy Ramanujam theorem states that the number of prime factors of n will approximately be log(log(n)) for most natural numbers n
Examples : 
 

5192 has 2 distinct prime factors and log(log(5192)) = 2.1615 
51242183 has 3 distinct prime facts and log(log(51242183)) = 2.8765


As the statement quotes, it is only an approximation. There are counter examples such as 
 

510510 has 7 distinct prime factors but log(log(510510)) = 2.5759 
1048576 has 1 prime factor but log(log(1048576)) = 2.62922


This theorem is mainly used in approximation algorithms and its proof lead to bigger concepts in probability theory. 
 


Output: 
The number of distinct prime factors is/are 3
The value of log(log(n)) is 2.8765

 

Time Complexity: O(sqrt(n))

Auxiliary Space: O(1)

Comment
Article Tags: