Patterns in twin primes Hi guys so I was reading this question in an old textbook
Given a pair of twin primes, a and b
both are prime and b = a + 2
So when a > 5
So for example, a = 149 and b = 149 + 2 = 151  
The product is 22499, so adding two gives 22501 and as this is prime this gives us our first prime that we need
There are 22 primes between 6 and 10000 that are expressed in the form ab + 2
So for example (149,151) is a pair of twin primes that is one of the 22
It then goes on to say that all of these primes are part of the same congruence class modulo 100
So I calculated it to find out they are all congruent to 1
Would someone be able to help me figure it out why this works?
The first thing I noted was that for any of the twin primes to work and be one of the 22, the units of the two primes have to add to 10 But I don't see how I could prove this works for all?
Thanks for any help guys!
 A: With $a=2n-1$ and $b=2n+1$, your prime number $p=ab+2$ has the form 
$$p=(2n-1)(2n+1)+2=(2n)^2+1$$
Neither $2n-1$ nor $2n+1$ must be divisible by 5, so $2n$ can only be congruent 0, 2 or -2 modulo 5.
If $2n \equiv \pm2$ (mod 5), then $p \equiv (2n)^2+1 \equiv 4+1 \equiv 0$ (mod 5), which is of course not possible, since $p$ is a prime number (also greater than 5).
Therefore, it must be $2n \equiv 0$ (mod 5) and so $(2n)^2 \equiv 0$ (mod 25). Also, $2n \equiv 0$ (mod 2) and so $(2n)^2 \equiv 0$ (mod 4). Since 4 and 25 are relatively prime, it follows that $(2n)^2 \equiv 0$ (mod 4*25) and therefore $p = (2n)^2+1 \equiv 1$ (mod 100).
A: Twin primes are always both odd (meaning they will have $1,3,5,7,9)$ as their final digit), and no number $>5$ ending in the digit $5$ can be a prime, since it will be divisible by $5$. So any pair twin primes (other than $(5,7)$ which was excluded by OP) will differ by $2$, and must have as their last digits one of $(1,3),\ (7,9),\ (9,1)$. Thus the product of such twin primes will end in the digit $3$ (for $(1,3),\ (7,9)$) or $9$ (for $(9,1)$). Twin primes whose product ends in $3$ cannot generate a prime by adding $2$, since that sum will end in the digit $5$ and thus be divisible by $5$. Therefore qualifying twin primes must end in the digits $(9,1)$. This explains OP's observation that the units place of such primes always add up to $10$.
All odd primes $>3$ have the form $6n\pm 1$, so any particular twin prime will be $(6k-1),(6k+1)$ for some specific $k$. If $(6k-1)$ ends in the digit $9$ and $(6k+1)$ ends in the digit $1$, then $6k$ ends in the digit $0$, meaning that $5\mid k$.
Let $k=5m$. Then each qualifying twin prime will have the form $(30m-1),(30m+1)$, and their product will be $900m^2-1$. Adding $2$ to this number gives $900m^2+1$. Since $100\mid 900$, $900m^2+1 \equiv 1 \mod(100)$. QED
