Python | sympy.smoothness() method
With the help of sympy.smoothness() method, we can find smoothness and power-smoothness of a given number. The smoothness of a number is its largest prime factor and the power-smoothness is its largest divisor raised to its multiplicity.
Syntax:
smoothness(n)Parameter:
n – It denotes the number for which the smoothness and power-smoothness is calculated.Returns:
Returns a tuple of smoothness and power-smoothness of the given number.
Example #1:
# import smoothness() method from sympyfrom sympy.ntheory.factor_ import smoothness n = 64 # Use smoothness() method smoothness_n, power_smoothness_n = smoothness(n) print("The smoothness and power-smoothness of {} is {} and {} respectively". format(n, smoothness_n, power_smoothness_n)) |
Output:
The smoothness and power-smoothness of 64 is 2 and 64 respectively
Example #2:
from sympy.ntheory.factor_ import smoothness n = 2**4 * 13 # Use smoothness() method smoothness_n, power_smoothness_n = smoothness(n) print("The smoothness and power-smoothness of {} is {} and {} respectively". format(n, smoothness_n, power_smoothness_n)) |
Output:
The smoothness and power-smoothness of 208 is 13 and 16 respectively


