Python | sympy.primeomega() method

With the help of sympy.primeomega() method, we can calculate the number of prime factors counting multiplicities for a given positive integer. For example, primeomega(12) = 3, since 12 = 22 * 31. Therefore, number of prime factors = sum of multiplicities of prime factors, 2 + 1 = 3.

Syntax: primeomega(n)

Parameter:
n – It denotes an integer.

Returns: Returns the number of prime factors counting multiplicities for a given positive integer.

Example #1:

 # import primeomega() method from sympy from sympy.ntheory.factor_ import primeomega    n = 24    # Use primeomega() method  primeomega_n = primeomega(n)         print(" Number of prime factors of {} = {} ".format(n, primeomega_n))

Output:

Number of prime factors of 24 = 4

Example #2:

 # import primeomega() method from sympy from sympy.ntheory.factor_ import primeomega    n = 120    # Use primeomega() method  primeomega_n = primeomega(n)         print(" Number of prime factors of {} = {} ".format(n, primeomega_n))

Output:

Number of prime factors of 120 = 5

My Personal Notes arrow_drop_up Coder Machine Learner Social Activist Vocalist

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.