# How do I extract base(3) and index (15) from $3^{15}$ in SageMath?

How do I extract base(3) and index (15) from $3^{15$} in SageMath?

add a comment

How do I extract base(3) and index (15) from $3^{15}$ in SageMath?

How do I extract base(3) and index (15) from $3^{15$} in SageMath?

add a comment

2

You can use the `is_prime_power`

method:

```
sage: a = 3**15
sage: a.is_prime_power()
True
sage: a.is_prime_power(get_data=True)
(3, 15)
```

Asked: **
2020-04-16 09:24:00 -0600
**

Seen: **35 times**

Last updated: **Apr 16**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.