Ask Your Question

Powers in modular arithmetic

asked 2024-03-26 12:10:20 +0200

Emm gravatar image

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.
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2024-03-26 14:20:58 +0200

Max Alekseyev gravatar image

Perhaps, the easiest way is to use pari.ispower():

pari.ispower(Mod(n,q), b)
edit flag offensive delete link more


That's perfect, thanks! I had forgotten how to access pari commands...

Emm gravatar imageEmm ( 2024-03-26 15:02:10 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2024-03-26 12:10:20 +0200

Seen: 117 times

Last updated: Mar 26