0
$\begingroup$

I have a prime number $p$, and I need to compute $p$ ↑↑ $k$ mod $m$.

here p ↑↑ k can be written as p ^ (p ^ (p ^ (p ... k times)))

for example -

$p = 5, k = 3, m = 3$

5 ↑↑ 3 = 5 ^ (5 ^ 5) % 3 = 2

Here $p$ is prime number, $2 <= p <= 10 ^ 8$, and $p - 2 <= m <= 10 ^ 8$.

$\endgroup$
  • 2
    $\begingroup$ So what exactly is your question? What kind of answer are you expecting here? $\endgroup$ – Omnomnomnom Apr 26 '17 at 16:18
  • 1
    $\begingroup$ If $k$ is higher than a certain constant (different for every prime), the residue will be constant. That might be interesting to you. $\endgroup$ – Mastrem Apr 26 '17 at 16:19
  • $\begingroup$ @Omnomnomnom i need ans for p ↑↑ k mod m $\endgroup$ – Atul Apr 26 '17 at 16:36
  • 2
    $\begingroup$ This answer might help: stackoverflow.com/questions/21367824/… $\endgroup$ – Isaac Browne Apr 26 '17 at 17:05
  • 1
    $\begingroup$ But the thing which I find weird is that the same question was posted here 4 hours ago and here 2 days ago.... $\endgroup$ – Blitzkrieg Apr 26 '17 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.