TITLE: Infinitely many primes of the form $8n+1$
QUESTION [11 upvotes]: I'm looking at this funny little problem involving proving the existence of an infinite number of primes of a certain form:

Prove that there are infinitely many prime numbers expressible in the
  form $8n+1$ where $n$ is a positive integer.

My proof goes like this:
Assume by way of contradiction that there are only finitely many of such prime numbers, say $p_1,p_2,\ldots,p_r$. Consider $p = 16p_1^4p_2^4\cdots p_r^4 +1 = (2p_1p_2 \cdots p_r)^4+1$. Recall that the congruence $x^4 \equiv -1 \mod p$ is solvable if and only if $p \equiv 1 \mod 8$. $p$ cannot be a prime of the form $8n+1$, but $p \equiv 1 \mod 8$, contradiction. Thus, there must be infinitely many prime numbers of the form $8n+1$.
I'm not quite sure if I actually achieve a contradiction here. Can you help me clarify this?

REPLY [7 votes]: Claim:
The odd prime divisors of $n^4+1$ are of the form $8k+1$
From $n^4\equiv -1\pmod{p}$ we have $n^8\equiv 1\pmod{p}$, therefore the order of $n$ modulo $p$ is $8$, and from the following theorem:

If $a$ is of order $k$ modulo $n$, then $a^h\equiv 1\pmod{n}$ iff $k|h$. Also $k|\phi(n)$.

It follows that $8|\phi(p)$, or in other words: $p=8k+1$.