0
$\begingroup$

I'm a software developer, trying to write a simple formula for the following:

A person is tested and given a score (out of 100, but irrelevant). The number of criteria they fail adjusts their score as follows:

1st failed field = -5

2nd failed field = -10

3rd failed field = -15

4th failed field = -20

5th failed field = -25

These adjustments are cumulative, so if you fail 3 fields your score is adjusted by -30; 4 fails and you get -50.

So, the result is:

1 = -5

2 = -15

3 = -30

4 = -50

5 = -75

First thing in the morning I'm struggling to figure out the formula for this... I thought the answer was something like:

n^2 - ((n-1)^2 - ((n-2)^2 - ...

But it's the recursion that I can't figure out how to express correctly.

Edit:

OK, I think I got it as:

(0.5 * (n + 1)) * n * 5
$\endgroup$
4
  • $\begingroup$ I'm trying to figure out what you mean, but I'm rather confused. What is different between the number failed above and failing fields? I you list you say $3$ failed $= -15$ but failing $3$ fields changes the score by $-30$. What is the difference between these statements? $\endgroup$ Commented Nov 16, 2015 at 11:24
  • $\begingroup$ @MichaelBurr Sorry, I realise that was poorly explained. Post updated. $\endgroup$
    – BadHorsie
    Commented Nov 16, 2015 at 11:29
  • $\begingroup$ $$-\frac{5n(n+1)}2$$. $\endgroup$
    – user65203
    Commented Nov 16, 2015 at 11:37
  • $\begingroup$ @YvesDaoust Thanks, I just figured it out but yours is more elegantly written. If you post, I will accept. $\endgroup$
    – BadHorsie
    Commented Nov 16, 2015 at 11:40

1 Answer 1

0
$\begingroup$

By the Faulhaber formula (triangular numbers), the penalty is

$$-5\cdot\frac{n(n+1)}2.$$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .