Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this question:

$a \equiv 12^{772} \pmod{71}$, when $0 \leq a < 71$

and I am having troubles getting it started.

$\frac{772}{71}$ is $10$ with a remainder of $62$;

How do I do this question?

share|cite|improve this question
@infrequentpylon: I edited your question. (Typeset it and added the number theory tag) – user17762 Dec 3 '10 at 1:26
up vote 4 down vote accepted

$12^{772}=12^{71\cdot 10+62}\equiv 12^{10+62}=12^{71+1}\equiv 12\cdot 12=144\equiv 2$ mod $71$. So $a=2$.


$12^{772}=12^{70\cdot 11+2}\equiv 12^2=144\equiv 2$ mod $71$.

The first one uses the form $a^p\equiv a$ mod $p$ and the second uses the form $a^{p-1}\equiv 1$ mod $p$ if $gcd(a,p)=1$ where $p$ is prime.

share|cite|improve this answer

HINT $\rm\ \ \ X^N \equiv X\ \ \Rightarrow\ \ X^{A + B\ N + C\ N^2 + \cdots} \equiv\ X^{A + B + C + \cdots}\ (mod\ N)$

NOTE $\ $ This is nothing but "casting out orders" - a cyclic group analog of casting out nines. Namely, $\rm\ X^{N-1} = 1\ \Rightarrow\ X^N = X\ $ so we can map $\rm\ N\to 1$ when calculating integral powers of $\rm\:X\:$.

When $\rm\:X\:$ has order dividing $\:9\:,\:$ then it amounts precisely to casting out nines from its exponents. For example, $\rm\ mod\ 27:\ (-2)^9 \equiv 1\ \Rightarrow\ (-2)^{721} \equiv -2\ \ $ since $\rm\ \ 721\equiv 7+2+1\equiv 1\ \:(mod\ 9)$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.