Solution of tanx = x?
Apart from the solution $x=0$ there are for each $n>0$ two solutions $\pm x_n$ with $x_n={(2n-1)\pi\over2}-\tau_n$ where $\tau_n>0$ is $O({1\over n})$. It is easy to see that $\tau_n$ satisfies the equation $$\tau=\arctan{1\over (2n-1)\pi/2 - \tau}=:f(\tau).$$ As $|f'(\tau)|\ll1$ in the neighbourhood of $\tau=0$ we can obtain $\tau_n$ numerically by iterating $f$ starting at $\tau=0$.
You know that there is a solution $x_k$ in a neighbourhood of $2 \pi k$, for each integer $k$.
And the equation can be also written as
$x_k = \arctan(x_k) + 2 k \pi$
where the arc tangent returns the principal value.
Then you can iterate:
$x_k[0] = 2 k \pi$
$x_k[n] = \arctan(x_k[n-1]) + 2 k \pi$
It converges very quickly - empirically - proof is left as an exercise :)
If you have an starting approximate value, you pick your $k$ by rounding $x_0/(2 \pi)$