# Representing Iterations in Math

I'm coming from a software engineering background and not a mathematical one. You may have to explain the exact notation to me but I would really appreciate it. I want to represent one of my processes as a single mathematical formula.

If I have a starting integer A (lets say its 5)
I also have an array of numbers Z[] with n number of positions, lets say Z contains [1, .5, 2, .5, 1...]
I will iterate over n and decrement each iteration that Z[n] value from A until A reaches or goes below 0.

First Iteration
5 - Z = 5 - 1 = 4
Second iteration
4-Z = 4-.5 = 3.5
and so on...
3.5 - Z = 3.5 - 2 = 1.5
1.5 - Z = 1.5 - .5 = 1
1 - Z = 1 - 1 = 0

The result I'm looking for is the final n value, in this example that would be 4. I'm trying to represent this process as a singular mathematical formula. From reading other posts I think the final result will be something similar to the below, but I'm honestly not too sure
$$X=min\{x∈N∣∑(formulaHere)<=0\}$$

• Just to clarify your question, are you asking about the general ideas/notation/perspective? Or about this particular problem (only), in which my first reaction is "why start with $A$ and subtract when you could ask when the sum first reaches or exceeds $A$?"? – Mark S. Mar 12 at 23:20
As @Mark S observes, this can be expressed as $$\min_n \{n \mid (\sum_{i=0}^n Z_i) \ge A \}.$$