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[0] = 5 - 1 = 4
Second iteration
4-Z[1] = 4-.5 = 3.5
and so on...
3.5 - Z[2] = 3.5 - 2 = 1.5
1.5 - Z[3] = 1.5 - .5 = 1
1 - Z[4] = 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

Please and thank you!

  • 1
    $\begingroup$ 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$?"? $\endgroup$ – Mark S. Mar 12 at 23:20
  • $\begingroup$ @MarkS. Consider my mind blown. Thank you so much. $\endgroup$ – Richard Polson Mar 13 at 0:15

As @Mark S observes, this can be expressed as $$ \min_n \{n \mid (\sum_{i=0}^n Z_i) \ge A \}. $$

  • $\begingroup$ Thank you. Adding to the initial number and summing the values makes way more sense! $\endgroup$ – Richard Polson Mar 13 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.