RSA factorization for special primes $p$ and $q$
Let $N=p\,q$ be an RSA modulus such that $p&gt;N^\beta$ and $\displaystyle p=\sum_{i=0}^k a_i\,x^i$ such that $\max(a_i)&lt;N^\delta$ and


  $$\delta &lt;\frac{1}{k+1}\bigl(1-(1-\beta)^\frac{k+1}{k}-(k+1)(1-(1-\beta)^\frac{1}{k})(1-\beta)\bigr).$$


Then one can factor $N$ in polynomial time (see here).

In your question $a\ne b$. Let $b=a+c$. So 


  $$p=2a^2+2ca+c^2,\ q=2a^2+2c+1.$$


In this case ($q&gt;N^{0.499}$, $k=2$)  we have $a_0=2c+1, a_1=0$ and $a_2=2$ which means that if $2c+1&lt;N^\delta$ then we can factor $N$ in polynomial time.