Checking whether an integer $n$ has a divisor in a given interval is essentially equivalent to factorization. Factoring is essentially equivalent to finding the smallest prime factor. So suppose that $n$ is not prime. Then check whether $n$ has a prime factor in $[1, n^{1/4}]$. Depending on the outcome check whether $n$ has a factor in $[1, n^{1/8}]$ or in $[n^{1/4}, n^{3/8}]$. After $\frac{\log n}{\log 2}$ steps you have determined the smallest prime factor of $n$. So as far as we know, checking for factors in an arbitrary interval is a lot more difficult than checking for factors in $[2, n-1]$.