Series (2 points)

Given an integer, \(a\), we define the following sequence:

\[\begin{split}& t_1 = a \\ & t_i = t_{i-1}/i, \quad i\geq 2 \\\end{split}\]

For example, the first 4 items of this sequence are: \(a, a/2, a/6, a/24\)

Write function series() that takes two integers, a and z (int) and returns the number of terms of the sequence (int) that we need to add to get a value greater than or equal to z, i. e., the smallest index \(i\) such that \(\sum_{n=1}^{i}t_n \geq z\).

Save this function in file series.py.

Examples:

>>> series (4, 5)
2
>>> series (100, 160)
3
>>> series (5040, 8635)
5
>>> series (48, 60)
2

Note

More tests are provided in file test-series.txt.