Python | sympy.primepi() method Last Updated : 26 Aug, 2019 Comments Improve Suggest changes Like Article Like Report With the help of sympy.primepi() method, we can find the number of prime numbers less than or equal to a given number. Syntax: primepi(n) Parameter: n - It denotes the number up to which the count of prime number is calculated. Returns: Returns the number of prime numbers less than or equal to n. Example #1: Python3 # import primepi() method from sympy from sympy import primepi n = 10 # Use primepi() method count_primes = primepi(n) print("The number of prime numbers less than or equal to {} is {}".format(n, count_primes)) Output: The number of prime numbers less than or equal to 10 is 4 Example #2: Python3 # import primepi() method from sympy from sympy import primepi n = 150 # Use primepi() method count_primes = primepi(n) print("The number of prime numbers less than or equal to {} is {}".format(n, count_primes)) Output: The number of prime numbers less than or equal to 150 is 35 Comment More infoAdvertise with us Next Article Python | sympy.prime() method R rupesh_rao Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | sympy.prime() method With the help of sympy.prime() method, we can find the nth prime, with the primes indexed as prime(1) = 2, prime(2) = 3, etc. Syntax: prime(n) Parameter: n - It denotes the nth prime number. Returns: Returns the nth prime number. Example #1: Python3 # import sympy from sympy import prime n = 5 # Use 1 min read Python | sympy.prime() method With the help of sympy.prime() method, we can find the nth prime, with the primes indexed as prime(1) = 2, prime(2) = 3, etc. Syntax: prime(n) Parameter: n - It denotes the nth prime number. Returns: Returns the nth prime number. Example #1: Python3 # import sympy from sympy import prime n = 5 # Use 1 min read Python | sympy.prime() method With the help of sympy.prime() method, we can find the nth prime, with the primes indexed as prime(1) = 2, prime(2) = 3, etc. Syntax: prime(n) Parameter: n - It denotes the nth prime number. Returns: Returns the nth prime number. Example #1: Python3 # import sympy from sympy import prime n = 5 # Use 1 min read Python | sympy.primenu() method With the help of sympy.primenu() method, we can calculate the number of distinct prime factors for a given positive integer. Syntax: primenu(n) Parameter: n - It denotes an integer. Returns: Returns the number of distinct prime factors for the given positive integer. Example #1: Python3 # import pri 1 min read Python | sympy.primenu() method With the help of sympy.primenu() method, we can calculate the number of distinct prime factors for a given positive integer. Syntax: primenu(n) Parameter: n - It denotes an integer. Returns: Returns the number of distinct prime factors for the given positive integer. Example #1: Python3 # import pri 1 min read Python | sympy.primorial() method With the help of sympy.primorial() method, we can find the product of the first n primes (default) or the primes less than or equal to n (when nth=False), where n and nth are parameters to the method. Syntax: primorial(n, nth) Parameter: n - It denotes the number for which the product of first n pri 2 min read Like