$\dfrac{n+5}{d} = q + \dfrac{2}{d} \tag 1$
$\dfrac{4n-4}{d+1} = 2q+2 + \dfrac{2d-6}{d+1} \tag 2$
If we require that $0 \le 2d-6 < d+1$, then we must have $3 \le d \le 6$
Solving $(2)$ for $2n$, we get
\begin{align}
(4n-4)=(d+1)(2q+2)+(2d-6)
&\implies (2n-2)=(d+1)(q+1)+(d-3) \\
&\implies 2n-2 = 2d+q+dq-2 \\
&\implies 2n = 2d+q+dq \\
\end{align}
Solving $(1)$ for $n$, we get
$n+5 = dq+2 \quad \implies \quad n = dq-3$
Eliminating $n$,
\begin{align}
2(dq-3) &= 2d+q+dq \\
2dq-6 &= 2d+q+dq \\
dq &= 2d+q+6 \\
2d-dq+q &= -6 \\
d(2-q)-(2-q) &= -8 \\
(d-1)(q-2) &= 8
\end{align}
Remembering that $3 \le d \le 6$, there is only one all-integer solution to $(d-1)(q-2) = 8$, and it gives us $n=15, d=3,$ and $q=6$.
I'd appreciate if you can help me with that.
– gobaldia Apr 05 '17 at 03:34