refactored to loop over n and breaking if outside mandelbrot