Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Powers in modular arithmetic

How can I detect if an integer n modulo q (not necessary a prime number) is a b-power for a given integer b?

Something like Integers(q)(n).is_power(b) that would return:

  • true if there exists $k$ such that n=k^b\pmod{q}
  • false otherwise.