Can you find your location in $\mathbb{Z}$ using least prime factor? Suppose you have a semi-black-box function:
$$f(x):=\mathrm{lpf}((N+x)^2+1)$$
where $\mathrm{lpf}$ means least prime factor, and $N\in\mathbb{Z}$ is some constant which you do not know.
You can use this function as much as you want with whatever values of $x\in\mathbb{Z}$ you want. My question is, assuming that $N$ is a finite integer value, and there's no trickery going on, is it possible to determine the value of $N$ with a finite amount of function queries?
 A: Here is one way utilizing that $x,N \in \mathbb{Z}$ and $\mathrm{lpf}(1):=1$ (second part might need additional clarification by OP, but without it the function would be undefined so assuming this is a natural definition). 
As mentioned in comments, we have $f(-N)=1$ and this is the only value of $x$ for which $f(x)=1$ - for all other values we have $(N+x)^2+1>1$ and so it divisible by at least one prime. So we just need to try all $|x| \leq |N|$, which takes finite amount of queries, at most $2|N|+1$. 
This can be improved significantly by using the fact that upon hitting $(N+x)^2+1$ a prime, we have $f(x)=(N+x)^2+1$, and so $N=\pm\sqrt{f(x)-1}-x$. So whenever $f(x)-1$ is a square and one of two resulting $N$'s satisfies $f(-N)=1$, we can terminate. This speeds up the searching significantly for large $N$, but still needs to be combined with previous approach which guarantees it will terminate (otherwise the algorithm would rely on assumption that there are infinitely many primes of form $n^2+1$ - which is an open problem).
A: Suppose $N$ is known to be in an interval of length $M$.  The primes will never be $3\pmod4$.  Suppose there are $K$ other primes whose product is at least $M$.  Run through in order:  
1) try $x=0$ and $x=1$ to find whether $N$ is even or odd.
2) try five $x$, avoiding $f(x)=2$, to find $N\pmod5$.
3) try thirteen $x$, avoiding $f(x)\le5$, to find $N\pmod{13}$ and so on.  
I think it takes about $O((\ln M)^2/2\ln \ln M)$ steps.  
Edit:  The following method takes at most $O(2\ln M/\ln\ln M)$ steps.  
Let $A,B,C$ be three bins to put numbers in.  Bin $A$ is for primes that have not yet appeared as $p=f(x)$.  Bin $B$ is for primes that have appeared once, and bin $C$ for primes that have appeared twice.
After $n$ steps, $N\pmod p$ can be one of at most $p$ different values for each $p\in A$.  $N\pmod p$ can be one of two values for each $p\in B$.   $N\pmod p$ is known for each $p\in C$.
Take the first $K$ prime numbers of the form $4q+1$.  $K$ is large enough that twice the product of these primes is at least $M$.  Put them all in bin $A$.
Let $x_1$ be any number.  Now, for each step:
Let $p_n=f(x_n)$
1) If $p_n$ is in bin $B$, move it and all smaller primes in $B$ to bin $C$.
2) If  $p_n\in A$, move it to bin $B$.
3) For each prime $p\in A, p\lt p_n$, rule out values of $N\pmod p$ that would have made the square+1 a multiple of $p$.  If there are two values left, move $p$ to $B$. If there is one value left, move $p$ to $C$.
4) If $p_n$ is in neither bin, and is odd, place $p_n$ in bin $B$, and move any primes $p\in B, p\lt p_n$ to $C$.
5) In the first step, put $2$ in bin $C$.  
Choose $x_{n+1}$ according to its remainders modulo every prime in the bins.
6)  If $p\in A$, make $x_{n+1}\pmod p$ different from all those that have been ruled out in step 3.
7) If $p\in B$, there are two possible values for $N\pmod p$.  Choose $x_{n+1}$ so that the square+1 is a multiple of $p$ for one of those options.
8) If $p\in C$, make sure the square+1 is not a multiple of $p$.  
Stop when the product of the primes in $C$ is at least $M$.  If $P$ is the largest of the original $K$ primes, the process stops in at most $2P$ steps.
