I'm seeing all the f's look good when they are square. I'm thinking we could increment or decrement D (f function) until we get f as a square. Then (x+n) is the square root of f
I think that the gcd of (x+n,f) for the starting record and the gcd of (x+n,f) for the correct record are always related somehow. Usually the correct one is a factor of the starting one. Sometimes the correct is a multiple of the starting one. We could do recursive like this:
get e,n,d,x,a,b
get gcd(x+n,f)
factor that:
go through the factors (or multiples of the factors) as (x+n) to test if (x+n)^2 + c is square.
If nothing works, start iterating the original gcd.
???
Profit!