Answer: (p,q)=(3,3),(7,5).
If q=2 then no pair (p,2) satisfies the equation. If q=3 and q=5 then the only pairs satisfying the equation are (3,3) and (5,7), respectively.
Let us show that there is no solution for q≥7. Consider the binary representation of q: q=2a1+2a2+⋯+2ar where 0≤a1<a2<⋯<ar are integers and r is the number of 1's in the binary representation of q. For all 1≤k≤r and 1≤i≤ak the number 2i2ak is an integer. Furthermore, when i>ak, we get ⌊2i2ak⌋=0.
Finally, we have ∑i=1∞⌊2i2ak⌋=2ak−1. Therefore, v2(q!), the highest power of 2 in q! can be written as
v2(q!)=i=1∑∞⌊2iq⌋=q−r.
The original equation is equivalent to 2q−2(2p−q+2−1)=q!, where p−q+2>0. Hence v2(q!)=q−2. Therefore, r=2 and q=2a1+2a2. Since q is a prime number, we get a1=0 and a2=2t for some non-negative integer t (q is a Fermat prime).
As q≥7 we have 2p−q+2≡1(mod7) and p−q+2≡0(mod3). Using the fact q=22t+1≡2(mod3) we get 3∣p and hence p=3. For q≥7 no pair (3,q) satisfies the equation. Done.