How to represent a mathematical series
<p>I want to build a function, that one of it arguments is series <code>{x[i], i = 0, 1, ..., inf}</code>.</p>

<p>For example: <code>x_m = 1/(1+x_(m-1)), m=1,2....inf</code></p>

<p>With this series, I want to check for every x[i], if it satisfy some condition that I will define (I don't know for which n it will satisfied).  </p>

<p>for example:</p>

<p>If <code>x_0 &lt; 5</code>, then I will return the value of x_0. </p>

<p>If not - I will check it for <code>x_1</code>. If <code>x_1&lt;5</code>, I will return the value of <code>x_1</code>.</p>

<p>and so on..</p>

<p>NOTE: <code>x_1</code> need to know the value of <code>x_0</code> for it calculation.</p>

<p>There is a easy way to represnt this series in Java? </p>
