0

I want to calculate the total cost of an investment in a game.

For each level, the costs is increased with 5000, i.e. lvl 1 costs 5000, lvl 2 costs 1000 and lvl 3 costs 1500 etc. At level 3, the total costs is 30000.

How can I calculate the total costs at lvl 45? Currently I'm adding it manually in Excel which takes quite a lot of time. I'd love to google or search this but I have no idea what to search for.

Henny Lee
  • 115

1 Answers1

0

This is simply a linear function.
Let $f(x) = mx$ where $f(x)$ is the cost at level $x$ and $m$ is the slope (the rate of increase of $f(x)$, i.e. how much $f$ increases by a one-unit change in $x$).
Since for each unit change of $x$ (for each additional level), we get an additional $5000$ in costs, then $m=5000$.
So $$f(x)=5000x.$$

So the costs at level $45$ is $f(45) = 5000\times 45$.


After your edit: The total costs at level 45 is
(cost at level $1$) + (cost at level $2$) $+ \ldots + $ (cost at level $45$)
$$=f(1) + f(2) + \ldots + f(45) \\ = 5000(1) + 5000(2) + \ldots + 5000(45) \\ = 5000(1+2+3+4+\ldots+45) \\ \stackrel{\dagger}{=} 5000\times\frac{45(46)}{2}$$
$(\dagger):$ from the formula for sum of first $N$ positive integers
$$1+2+3+\ldots+N = \frac{N(N+1)}{2}$$

If you're doing this in Excel, the important step is the $(\dagger)$ step.