# Python | sympy.trailing() method

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:

 `# import trailing() method from sympy ` `from` `sympy.ntheory.factor_ ``import` `trailing ` `  `  `n ``=` `64` `  `  `# Use trailing() method  ` `trailing_n ``=` `trailing(n)  ` `      `  `print``(``"The largest power of 2 that divides {} is 2^{}."``. ` `      ``format``(n, trailing_n)) `

Output:

```The largest power of 2 that divides 64 is 2^6.
```

Example #2:

 `# import trailing() method from sympy ` `from` `sympy.ntheory.factor_ ``import` `trailing ` ` `  `n ``=` `130` ` `  `# Use trailing() method  ` `trailing_n ``=` `trailing(n)  ` `     `  `print``(``"The largest power of 2 that divides {} is 2^{}."``. ` `      ``format``(n, trailing_n)) `

Output:

```The largest power of 2 that divides 130 is 2^1.
```
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.