Ask Your Question

Revision history [back]

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)