# Python | sympy.perfect_power() method

With the help of sympy.perfect_power() method, we can find two integers b and e such that be is equal to the given number n.

Syntax:
perfect_power(n)

Parameter:
n – It denotes an integer.

Returns:
Returns a tuple of integers (b, e) such that be == n.

Example #1:

 `# import perfect_power() method from sympy ` `from` `sympy ``import` `perfect_power ` ` `  `n ``=` `64` ` `  `# Use perfect_power() method  ` `b, e ``=` `perfect_power(n)  ` `     `  `print``(``"n = {}"``.``format``(n)) ` `print``(``"b = {} and e = {}."``.``format``(b, e)) ` `print``(``"{}^{} == {}"``.``format``(b, e, n))  `

Output:

```n = 64
b = 2 and e = 6.
2^6 == 64
```

Example #2:

 `# import perfect_power() method from sympy ` `from` `sympy ``import` `perfect_power ` ` `  `n ``=` `64` ` `  `# Use perfect_power() method  ` `b, e ``=` `perfect_power(n, big ``=` `False``)  ` `     `  `print``(``"n = {}"``.``format``(n)) ` `print``(``"b = {} and e = {}."``.``format``(b, e)) ` `print``(``"{}^{} == {}"``.``format``(b, e, n))  `

Output:

```n = 64
b = 8 and e = 2.
8^2 == 64
```
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.