Given a prime $p$ and a natural number $k$, such that $k$ is not divisible by $p - 1$, prove that $\sum_{i = 1}^{p - 1}i^k \equiv 0 \pmod p$.  I split the proof into two cases: one where $k$ is odd and another where it is even.  The case where $k$ is odd can be proven as follows:  $$\sum_{i = 1}^{p - 1}i^k \equiv \sum_{i = 1}^{\frac{p - 1}{2}}i^k + \sum_{i = 1}^{\frac{p - 1}{2}}(-i)^k \pmod p$$  Since $k$ is odd each $(-i)^k = -i^k$, and will cancel with the positive $i$ leaving a zero. Therefore,   $$\sum_{i = 1}^{p - 1}i^k \equiv 0 \pmod p \text{ if $k$ is odd.} $$   I approached the case where $k$ is even in a similar fashion.   $$\sum_{i = 1}^{p - 1}i^k \equiv \sum_{i = 1}^{\frac{p - 1}{2}}i^k + \sum_{i = 1}^{\frac{p - 1}{2}}(-i)^k \equiv 2(\sum_{i = 1}^{\frac{p - 1}{2}}i^k) \space \pmod p$$  Since $p$ is prime, we just need to prove that $\displaystyle\sum_{i = 1}^{\frac{p - 1}{2}}i^k \equiv 0 \pmod p$.  I was stumped after this, so I considered a counterexample, one where $k$ is divisible by $p - 1$. In that I considered a case where $p = 5, k = 8$:  $$1^8 + 2^8 + 3^8 + 4^8 \equiv 1 + 1 + 1 + 1 \space \pmod p$$  This and a few other cases led to the conjecture that all the numbers below $p$ have a mod cycle $(mod \space p)$ that is divisible by $p - 1$. I tested it with $p = 7$.  $2: 2, 4, {\color{red}1}$  $3: 3, 2, 6, 4, 5, {\color{red}1}$  $4: 4, 2, {\color{red}1}$  $5: 5, 4, 6, 2, 3, {\color{red}1}$    After this I was stuck. I couldn't see how this would help me solve the problem. And, more importantly, I couldn't prove my conjecture.
How can I prove that $2017 \mid 1^{2017}+2^{2017}+\dots+2017^{2017}$? I tried proving it with the use of modulo, however it was to no avail. Afterwards, I  tried researching, for possible theorems, that may help, but that bore no fruit, either. Can you guys please help me proving it, as I am stuck? Thanking you in advance.
Export tikz as image file Getting opencv error in c++ Guid vs INT - Which is better as a primary key? Why are lamps and mesh lights not illuminating anything? Are moving objects producing stronger gravity fields? If the strength of gravitational influence exerted by a body is derived from its mass and energy then is it true that a moving object which has some kinetic energy should also produce stronger gravitational pull than a static/slower one?  If that's correct then would it be also possible for an object moving fast enough to produce gravity so strong that it would collapse into a (fast moving) black hole? What is $1^k+2^k+\cdots+ (p-1)^k$ modulo $p$? (From Ireland and Rosen). I've been working through a bit of Ireland and Rosen's Number Theory for fun. Problem 4.11 of Ireland and Rosen asks     Prove that $1^k+2^k+\cdots+(p-1)^k\equiv 0\pmod{p}$ if $p-1\nmid k$, and $-1\pmod{p}$ if $p-1\mid k$.    My work is leading where I didn't expect to go. Here I assume $p$ id odd. First, if $p-1\mid k$, then we can wrike $k=(p-1)j$ for some $j$. But then $$ 1^k+\cdots+(p-1)^k\equiv 1^{(p-1)j}+\cdots+(p-1)^{(p-1)j}\equiv \underbrace{1+\cdots+1}_{p-1\text{ times}}=\frac{(p-1)p}{2}\equiv 0\pmod{p} $$ since $p-1$ is even.   Secondly, I suppose $p-1\nmid k$. WLOG, I can assume $0&lt;k&lt;p-1$, Since if $k=(p-1)j+r$ with $0&lt;r&lt;p-1$, then  $$ a^k\equiv a^{(p-1)j+r}\equiv a^r\pmod{p}. $$  Then if $g$ is a primitive root, $$ 1^k+\cdots+(p-1)^k=\sum_{i=1}^{p-1}(g^k)^i=\frac{g^k(1-g^{k(p-1)})}{1-g^k}. $$ Since $g$ is primitive, $p\nmid 1-g^k$, but $p\mid 1-g^{k(p-1)}$, so the above sum is again congruent to $0\pmod{p}$.  So in all cases, I get the sum is congruent to $0$ regardless. Have I messed up, or is there a typo? Thanks. Is there any way to check whether a file is locked without using a try/catch block?    Right now, the only way I know of is to just open the file and catch any System.IO.IOException. Why doesn't Doctor Strange remove the Infinity Gauntlet from Thanos? Doctor Strange seemingly has the ability to open portals wherever he wants. We see at the beginning of Infinity War what happens when he closes a portal and someone isn't fully through it.  Is there any reason why he can't open a portal around the left-elbow of Thanos, and then close it?  I realize that Thanos probably wouldn't allow this to happen normally,      but when he is mostly asleep, and Tony and Spider-Man are pulling on the gauntlet, Doctor Strange has ample opportunity, and plenty of space to just sever Thanos' arm.   Why doesn't he? "does not contain a static 'main' method suitable for an entry point" Creating polyline-based "heatmap" from GPS tracks? This winter I am planning to track my downhill skiing/snowboarding using a GPS.  Most of my riding will occur at the same resort.  I would like to be able to create a sort of "heatmap" that shows the amount of runs that I have made in a given area.  As I add more and more GPS traces to my database, my goal would be to see a sort of linear heatmap of the most traveled areas.  Given the nature of downhill skiing, you would expect the uphill chairlift lines will be the "hottest" because it will be the only places visited over-and-over again.  Given that 1) my track will not be the same every time and 2) the area covered by following one "run" may be a few hundred feet wide, what might be the best way to analyze this "linear" data to create a sort of heatmap?  My thoughts were to buffer the lines, then intersect the polys to get a sort of Venn Diagram thing going.  My preference is to use open-source technologies.  I've got QGIS and PostGIS loaded and available.  UPDATE: In regards to @blah238's response, I was thinking of something that might be able to "collect" the number of passes ("runs") through an area, and then symbolize by the count.  Conceptually, this would be similar to ArcGIS "" (but for lines, not points) or  (but for multiple line in roughly the same area).  A more visual example of a similar concept might be a traffic-flow map, where highly-congested areas would equate to "highly-traveled" ski runs/areas:    I've read the following questions that may give some ideas, but they don't really address what I am trying to accomplish: What is the origin of "man on the spot"? What is the origin of "man on the spot" ?   defines on the spot and uses as an example man on the spot.     on the spot -  at the place in question; there; "they were on the spot when it happened"; "it had to be decided by the man on the   spot" (Emphasis added)   Some evidence suggests that the origin of the phrase refers to decisions made by officials of the past British empire and actions taken by them. How to set the same font size for all tables? How to create id with AUTO_INCREMENT on Oracle? How can I snap a window in a corner with 18.04? I am looking to use this feature for two purposes: scanning books (one camera pointed at each of a pair of pages), and for stereo 3D photography.  I would like to be able to preview and capture photos from two cameras simultaneously, and download them to my Mac (recent laptop, Mac OS X 10.8.x). Being able to keep track of which photos were from which camera is also a must.  I see a couple of packages that will do this via USB tethering on Windows, namely  (which other than being on Windows, looks perfect for my needs) and . I certainly could run Windows on my Mac somehow, but I'd rather avoid that, if possible.  I haven't bought the cameras yet, and I do not have any requirements as to which cameras are supported (it seems the packages above only support Canons), other than that they be relatively inexpensive. This is a hobby-type project, not a $3000 dSLR-type project.  However, even if all you have is a dSLR solution for this problem, I'd still like to hear about it. Perhaps it will lead to related solution.  Inventive hacky solutions welcome! I have written a small script to count number of occurrences of logs in a particular file. The following is my code:   #!/bin/sh count=1 while read line do     found=$( grep M $line )     OCCURENCE=$( grep M /log.txt)     if [ "$OCCURENCE" ]; then         echo $count")" $line &gt;&gt; filesave.txt     fi     count=$((count+1)) done &lt; log1.txt   but I am getting this error:  ./count.sh ./count.sh: syntax error at line 10: `found=$' unexpected Does a monk's Unarmored Movement speed increase apply to the fly speed gained from a Fly spell? Remote start up a machine that is in the shut down state? Possible Duplicate:          May I know how can one remote start up a machine that is in a shut down state? I am running 14.04 and have a HP Deskjet 2545 wireless printer which is supported by Ubuntu. I have run HpLIP, the latest version and installed the printer.  The printer is recognised by Ubuntu, printer and network, but LibreOffice do not see the printer. Only a Generic printer.  I don't know what to do anymore and would like to get some good advice I'm starting out in Visual C++ and I'd like to know how to keep the console window.  For instance this would be a typical "hello world" application:   int _tmain(int argc, _TCHAR* argv[]) {     cout &lt;&lt; "Hello World";     return 0; }   What's the line I'm missing?