# 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 primes or prime less than or equal to n is calculated.
nth – It denotes a boolean value. When True, it returns the product of first n primes whereas when False returns the product of primes less than or equal to n.

Returns: Returns the product of the first n primes or the primes less than or equal to n .

Example #1:

 `# import primorial() method from sympy ` `from` `sympy ``import` `primorial ` ` `  `n ``=` `3` ` `  `# Use primorial() method  ` `primorial_n ``=` `primorial(n) ``# 2 * 3 * 5 ` `     `  `print``(``"The product of first {} primes is {}"``.``format``(n, primorial_n)) `

Output:

```The product of first 3 primes is 30
```

Example #2:

 `# import primorial() method from sympy ` `from` `sympy ``import` `primorial ` ` `  `n ``=` `10` ` `  `# Use primorial() method  ` `primorial_n ``=` `primorial(n, nth ``=` `False``) ``# 2 * 3 * 5 * 7 ` `     `  `print``(``"The product of primes less than or equal to {} is {}"``.``format``(n, primorial_n))           `

Output:

```The product of primes less than or equal to 10 is 210
```
My Personal Notes arrow_drop_up Check out this Author's contributed articles.

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.