Now that I see what you are trying to do, I can offer a different bit of advice!
Your goal is to compute the mapping from $b$ to $n$ for every $b$. So
instead of solving $n$ from given $a,b,c,d$, you should solve for $b$ given $a,c,d,n$ and "fill in the mapping". (Basically we compute the inverse mapping, which I am pretty sure is computationally simpler.)
In fact, for each $n$ you can produce a "mask": the set of angles which will see a block at distance $n$. And this is easy to solve. You are looking for the values
$b$ satisfying
$$ nb \in [mc,mc+d) $$
for some $m$. This can be solved as
$$ b \in [\frac{mc}{n}, \frac{mc+d}{n}) $$
for $m$ an integer. And in particular their end points can be explicitly computed!
This also makes your reference to Mandelbrot set make more sense! To render your ray tracing, you probably want to start from the limit of visibility (with the $n$ and $m$ corresponding to the furthest you can see), compute the corresponding intervals $b$, paint them in, and then gradually drop $m,n$, overwriting the previous $b$ if necessary (nearer objects block out farther objects).
Basically the idea is to ignore the notion of the first $n$. Instead, for each block determine the angles $b$ which would see the block, if there were nothing else in the way. If you start from the farthest block and move closer, you will be able to decrease the corresponding $n$ value when a block blocks another block.