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:

filter_none

edit
close

play_arrow

link
brightness_4
code

# import smoothness() method from sympy
from 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))

chevron_right


Output:

The smoothness and power-smoothness of 64 is 2 and 64 respectively

Example #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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))

chevron_right


Output:

The smoothness and power-smoothness of 208 is 13 and 16 respectively


My Personal Notes arrow_drop_up

Coder Machine Learner Social Activist Vocalist

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.