Tuesday, October 7, 2025
HomeLanguagesPython | sympy.primeomega() method

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 
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32340 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6829 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6784 POSTS0 COMMENTS