When is $(p^2-1)/8$ even? I am trying to find for what values of p $\frac{p^2-1}{8}$ will be even number           $\frac{p^2-1}{8}=2m\implies (p-1)(p+1)=8(2m)$ then can I write $p\equiv 1\pmod8$ or $p\equiv -1\pmod8$ ?
Also trying to find for what values of p it will be an odd number
$\frac{p^2-1}{8}=(2m+1)\\\implies (p-1)(p+1)=8(2m+1)$$\text{ will it be } p\equiv 1\pmod8$ or $p\equiv -1\pmod8$ again? p is an odd prime
 A: I think you want to look at congruences modulo $16$, not $8$. After all, $\frac{p^2-1}8=2m$ if and only if $p^2-1=16m$, that is $p^2\equiv1\pmod{16}$. Similarly $\frac{p^2-1}8$ is odd if and only if $p^2-1=8+16m$, that is $p^2\equiv9\pmod{16}$.
By writing down all eight possibilities, you see that $n^2\equiv1\pmod{16}$ if and only if $n$ is congruent to one of $1,7,9,15$ modulo $16$. The other four possibilities, $n=3,5,11,13$ square to numbers $\equiv9\pmod{16}$. And I think that’s the whole story.
A: $\Box \ 4\mid p^2 - 1$ for all odd $p$.

Proof: For some $n\in\mathbb{Z}$, since $p$ is odd, then $p = 2n+1$. $$\begin{align} \therefore 4\mid (2n + 1)^2 - 1 &= (2n)^2 + 1^2 + 4n - 1\tag1 \\ &= 4n^2 + 4n \\ &= 4(2n^2 + 2n).\tag*{$\Box$}\end{align}$$ Notice though that $2n^2 + 2n = 2(n^2 + n)$. $$\therefore 4\times 2 = 8\mid (2n + 1)^2 - 1\tag*{$\because (1) = 8(n^2 + n)$}.$$ However, we want to show that $\dfrac{p^2 - 1}{8} = 2m$ for some $m\in\mathbb{Z}$, so this means that for all $n\in\mathbb{Z}$ we need to show that $n^2 + n = 2m$, and it is.
Proof: Set $n = 2k$ for some $k\in\mathbb{Z}$ then, $$\begin{align}(2k)^2 + 2k &= 4k^2 + 2k \\ &= 2(2k^2 + k)\tag*{$\begin{align} \therefore \,\,&m = k^2 + k \\ \Leftrightarrow \,\,&m\in\mathbb{Z}\end{align}$}.\end{align}$$ Set $n = 2k + 1$ then, $$\begin{align}(2k + 1)^2 + (2k + 1) &= (2k)^2 + 1^2 + 4k + 2k + 1 \\ &= 4k^2 + 6k + 2 \\ &= 2(2k^2 + 3k + 1).\tag*{$\begin{align} \therefore\,\, &m = 2k^2 + 3k + 1 \\ \Leftrightarrow\,\, &m\in\mathbb{Z}\end{align}$}\end{align}$$ Therefore, the thesis remains true. $\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\,\,\Box$
We arrive at the conclusion that $p$ is simply just an odd number, and since the set of prime numbers is contained within the set of odd numbers, then it is allowable for $p$ to be an odd prime. There is, however, the exception of $2$ but $2^2 - 1 = 3 < 4$ so we do not include this as a part of our set since $3/4\notin\mathbb{Z}$. And besides, it is an even number. 
Also, if $p^2 - 1 = 8$ then $2m = 1\Leftrightarrow m\notin \mathbb{Z}$ so here we have to be careful! The only value for $p$ that satisfies this equation is $3$, so we have to exclude that from our set as well. In general, $p$ can be any prime of the form $6t\pm 1$ for some $t\in\mathbb{Z^+}$ since of course $p > 0$, and so furthermore, we clarify that $m\in\mathbb{Z^+}$.

In the first part, it is be wrong writing it in modulo $8$ because we know that there is a bigger number than $8$ which divides into $p^2 - 1$, namely $16$ as @Lubin mentioned.
In the second part, expand $8(2m + 1)$ as $16m + 8$ so you obtain $$\frac{p^2 - 1}{8} - 8 = \frac{p^2 - 65}{8} = 16m.$$ Now we have that $p^2\equiv 65 \pmod{128 = 2^7}$.
