# Using Fermat's Little Theorem Prove if $p$ is prime, prove $1^p + 2^p + 3^p +…+(p-1)^p \equiv 0 \bmod{p}$

Using Fermat's Theorem Prove if $p$ is prime, prove $1^p + 2^p + 3^p +...+(p-1)^p \equiv 0 \bmod{p}$

The two definitions of Fermat's Little Theorem is $a^p \equiv a \bmod{p}$ and $a^{p-1} \equiv 1 \bmod{p}$ but I don't know how to use this solve the problem

Please help

-

## 3 Answers

Hint: Use Fermat's theorem for each $k$ ($1\le k\le p-1$) and add all them up. Then use Gauss's formula for the sum $1+2+\cdots +(p-1)$.

-

$1^p + ... + (p-1)^p \equiv 1 + 2 + ... (p-1) \equiv (1 + (p-1)) + (2 + (p-2)) + ... +(\frac{p-1}{2} + \frac{p+1}{2}) \equiv p + ... + p \equiv 0 (\mod p)$

Edit: Assuming p is an odd prime, of course

-

I understand the 1+(p-1)+2+(p-2)+.... part but how did you come up with (p-1/2 + p+1/2)? – Cindy Dec 10 '12 at 4:54
Because $p$ is odd, that'll be the last two pairs in the sum.  Write out some of these sums for various primes and you'll see where it comes from. – anonymous Dec 10 '12 at 16:39

Since $1^p \equiv 1$, and $2^p \equiv 2$, $\ldots$ $(p-1)^p \equiv p-1$, we have that

$$1^p + 2^p + \ldots (p-1)^p \equiv 1 + 2 + \ldots + p-1$$

However, we know this sum: $\sum_{i = 1}^{p-1} i = \frac{p (p-1)}{2}$, which for odd primes would be a multiple of $p$, and we are done by reducing modulo $p$, then we only must check the case for $2$, which doesn't hold, and it's awkward...

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 19, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9412335157394409, "perplexity_flag": "head"}