Drawing circles on a line (with the center of each circle at the intersection of the previous circle and the line) Sorry for the horrible title, feel free to come up with something smarter.
I want to produce the following result:
My desired result

To describe it shortly:


*

*I have a line of finite length. 

*I want to draw circles, their centers must always be on said line.

*The circles are drawn from left to right, getting gradually smaller. Their radii follow a function (see next image).

*The center of a new circle must always be exactly at the (right) intersection of the line and the previous circle. 


The function for the radii looks like this:
Exemplary function that defines the circles radii depending on the position of their respective centers on the line

I do know how to calculate my circles iteratively (one by one) but I want to implement this feature in Python (I'd love to use something else, but can't) and performance is relevant.
Is there a way of "vectorizing" this calculation, i.e. to calculate the total number of circles and their respective radii in a non-iterative way (so I can crunch processing times down with Numpy)?
EDIT: A little gif to show the process I'm talking about:
https://imgflip.com/gif/41z4dr
 A: contains a mistake: incorrect problem statement
I am not sure what you mean when you refer to "the total number  of circles", but if I understand correctly, you want to find the centre $x_n$ of the $n$-th circle in your sequence. From the construction, it is clear that $\forall k(x_{k+1}=x_k+f(k))$. From this, we can easily derive by induction that $$x_n = x_0 + \sum_{k=0}^{n-1} {\Big(4-2\sqrt{\frac k 2}\Big)} = x_0 + 4n-\frac 1 {\sqrt 2}\sum_{k=0}^{n-1} {\sqrt k}$$
Therefore, the only way to make your computation fast is to compute $\sum_{k=0}^{n-1} {\sqrt k}$ effectively. For example, you can use a formula $$\sum_{t=1}^n{\sqrt t} = C+\frac 23n^{\frac 23}+\frac 12n^{\frac 12}+n^{-\frac 12}(\frac 1{24}-\frac 1 {1920n^2}+\frac 1 {9216n^4}-\cdots)$$ (source)
In the formula, $C$ can be precalculated to the desired accuracy $C=\frac 1 {4\pi}\sum_{k=1}^\infty {k^{-\frac 32}}$ prior to the calculations and stored as a constant. This way, chopping the formula at $\frac 1 {n^4}$ term, gives a very high numerical accuracy, note that if $n=2$, $\frac 1 {9216n^2}$ is already $0.00000678168\dots$ . Every calculation then consist only of exponentiations instead of a costly sum or iterative steps.
The final form is $$x_n = x_0 + 4n - \frac 1{\sqrt 2}(C + \frac 23(n-1)\sqrt {n-1} + \frac 12 \sqrt {n-1} + \frac 1{\sqrt {n-1}} (\frac 1{24} - \frac 1{1920(n-1)^2}+\frac 1{9216(n-1)^4}))$$
You can add more terms at the end to increase the accuracy of the calculations, but the change would be minuscule. I also did not simplify the equation as it does not affect the speed of calculations.
Edit: $\forall n\ge 8 (f(n)\le 0)$ which means that you will only have 8 circles which defeats the purpose of optimization. Nevertheless, the presented solution works just as well for any coefficients in the formula $f(x)$.
