Open In App

Python | sympy.trailing() method

Last Updated : 05 Sep, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
With the help of sympy.trailing() method, we can count the number of trailing zero digits in the binary representation of a given number, i.e. determine the largest power of 2 that divides that number.
Syntax: trailing(n) Parameter: n - It denotes the number for which the largest power of 2 that divides that number is determined. Returns: Returns the largest power of 2 that divides the given number.
Example #1:
Output:
The largest power of 2 that divides 64 is 2^6.
Example #2:
Output:
The largest power of 2 that divides 130 is 2^1.

Article Tags :
Practice Tags :

Similar Reads