According to Fermat's Little Theorem, for all integer $a$, if $p$ is a prime, then $$a^p \equiv a \pmod p$$ In other words, there exists a non-zero integer $k$ such that $$a^p-a=pk$$ Is there a method to determine $k$? I have seen many proofs using the multinomial expansion and/or recurrent analysis but none explicitly mentioned what $k$ is? Any Hints?

EXPLANATION:let me be clearer, let's say, for any 2 integers $a,b$, if $p$ is odd, then $$(a+b)^p\equiv {a^p+b^p}\pmod p$$ In other words, there exists $k \in \mathbb {Z} \neq 0$ such that $$(a+b)^p=a^p+b^p+kp$$ In this case using the binomial expansion, it is easy to see that $$k=\dfrac{\sum_{k=1}^{p-1}{ n\choose k}a^{p-k}b^k}{p}$$ I was wondering if there is a similar expression of $k$ in the Fermat's Little Theorem.

  • 4
    $\begingroup$ One way to calculate it is to raise $a$ to the power $p$, sutract $a$ from the result, then divide that by $p$. I.e., finding $k$ is not difficult. Fermat's theorem simply proves that it is always an integer. $\endgroup$ Sep 5, 2015 at 2:49
  • 6
    $\begingroup$ It's $(a^p-a)/p$. What else is there to say? $\endgroup$
    – anon
    Sep 5, 2015 at 2:54

1 Answer 1


You are stating an equivalence between those two statements, namely $$a^p\,=\,a\;(mod\,p) \Longleftrightarrow\,a^p\,-\,a\,=p\,k$$ This means, that second statement is the definition of $k$.

1)Your example is not different as it is still giving $k$ in terms of the two sides and $p$. Thus it is not a method for calculating $k$ but it's merely re-expressing $k\,=\,\frac{(a+b)^b\,-\,(a^p+b^p)}{p}$ differently.

You could as well write $k=\frac{a\,(a^{p-1}-1)}{p}$ for the first relation. Not knowing how $a$ (and $b$ as well in your example) depends on $p$ the best you can do is give a formal expression for $k$ -as you do in your example.

2)If what you want is to still write it in terms of some power series you could argue as follows. Given that $\sum^{p-1}_{n=0}a^n\,=\,\frac{a^{p}-a}{a-1}$ for $a\neq1$, then $$k\,=\,\frac{(a-1)\,\sum^{p-1}_{n=0}a^n}{p}$$ But this doesn't provide you with a method for calculating $k$ different from directly using its definition.

  • $\begingroup$ Please see my edited post. $\endgroup$
    – user97615
    Sep 5, 2015 at 14:50
  • 2
    $\begingroup$ Now I'm not sure what you are asking, I have to admit. Initially I thought you were missing something in the definition of congruence, but now I'm thinking you haven't clearly posed a question. If what you want is introduce a power series in the expression of k, I've shown you one way. However, then you should state it clearly in your question what you want and why, that's is, what motives your question. This helps people get your mindset better and provide you with better answers. $\endgroup$
    – MASL
    Sep 5, 2015 at 16:26

You must log in to answer this question.