Finding p and q in RSA with a given n, |p-q|<10000
As @fgrieu said, it will work when ${|p-q|&lt; N^{1/4}}$ , where ${\sqrt N}$ and ${A}$ both are very nearer. then we can take ${A = \sqrt N}$ to start with.

Let ${A=(p+q)/2}$ , i.e., A is mid point of p and q, which could be nearer to ${\sqrt N}$

There exist an integer ${x}$ so that, ${A-x=p}$ and ${A+x=q}$

${N=pq}$ ${=}$ ${(A-x)(A+x)=A^2-x^2}$

${x= \sqrt{A^2-N}}$

Since we know A and N we can find x and subsequently p and q.