Python | sympy.subfactorial() method
Last Updated :
14 Jul, 2019
With the help of
sympy.subfactorial() method, we can find the
Subfactorial of a number in SymPy. Subfactorial of a number is given by –
Syntax: subfactorial(n)
Parameter:
n – It denotes the number whose subfactorial is to be calculated.
Returns: Returns the subfactorial of number, i. e., n.
Example #1:
from sympy import *
n = 4
print ( "Value of n = {}" . format (n))
subfactorial_n = subfactorial(n)
print ( "Subfactorial of n : {}" . format (subfactorial_n))
|
Output:
Value of n = 4
Subfactorial of n : 9
Example #2:
from sympy import *
n = 9
print ( "Value of n = {}" . format (n))
subfactorial_n = subfactorial(n)
print ( "Subfactorial of n : {}" . format (subfactorial_n))
|
Output:
Value of n = 9
Subfactorial of n : 133496
Share your thoughts in the comments
Please Login to comment...