Periodocity of $a^{pn+q}$ mod $m$

46 Views Asked by At

Is $a^{pn+q}$ mod $m$ periodic? $a$, $p$ and $q$ are constants. $n$ is varied here. If it is periodic then how can I find the periodicity efficiently? Thanks in advance.

1

There are 1 best solutions below

2
On BEST ANSWER

it has the same character of periodicity as $A \cdot P^n \pmod m$ where the constant parts of your function are renamed (and evaluated $\pmod m$ before) as $A=a^q $ and $P= a^p$ because you can write $a^q \cdot (a^p)^n \pmod m$