Using BBCode sup and sub tags, I rewrite the equation as
2
q-2 - 7 = x
2
where x is an integer and q is an odd prime.
Looks like we can use
Fermat's little theorem and
Quadratic residue results to find constraints on possible solutions.
Multiply both sides by 4:
2
q - 28 = (2x)
2
Now find the result modulo q, with FLT:
y
2 = -26 mod q
where y = 2x. If we know y, we can always find x mod q, since q is odd.
There's a special case: q = 13, and that yields y = 0 mod 13, and thus, x = 0 mod 13. However, that value of q is not a solution of the original equation.
To have a solution, -26 must be a quadratic residue of q. From QR theorems, all of -1, 2, and 13 must be QR's of q, or else only one of them may be.
The next step is to use
Quadratic reciprocity.
-1 is a QR of q <-> q = 1 mod 4 (1 or 5 mod 8)
2 is a QR of q <-> q = +-1 mod 8 (1 or 7 mod 8)
13 is q QR of Q <-> q is a QR of 13 (q = 1 mod 4) / -q is a QR of 13 (q = -1 mod 4)
That last condition is:
q = 1, 3, 4, 9, 10, 12 mod 13
in both cases.
Going over the possibilities:
ttt: q = 1 mod 8 and 1, 3, 4, 9, 10, 12 mod 13
fft: q = 3 mod 8 and 1, 3, 4, 9, 10, 12 mod 13
ftf: q = 7 mod 8 and 2, 5, 6, 7, 8, 11 mod 13
tff: q = 5 mod 8 and 2, 5, 6, 7, 8, 11 mod 13
I find q = 1, 3, 5, 7, 9, 13, 15, 17, 21, 25, 27, 31, 35, 37, 39, 43, 45, 47, 49, 51, 63, 71, 75, 81, 85, 93 mod 104
kurtulmehtap's solutions, 5, 7, 17, are in this list.