Total Cost of List of Items

273 Views Asked by At

Suppose you have a list of items. The end items cost 1 dollar each. The items next to the ends cost 2 dollars each and the items next to those (towards the middle) cost 3 dollars each and so on. Hence the most expensive item(s) are the one(s) in the middle. The total number of items in the list is n. How do I determine the total cost of the items in the list? It seems like there should be 2 different equations: one for when n is even and one for when n is odd. This is meant to be a middle school challenge problem so I assume it does not use summation notation. I would appreciate any help.

I got 0.25n^2 + 0.5n as the equation for even n and 0.25n^2 + 0.5n + 0.25 for odd n by doing plug and check and excel plotting but what is the mathematical way to arrive at that?

2

There are 2 best solutions below

0
On

We can use summation notation to express our answer should we desire

Using cases of either having $n$ be even or odd,

$$2\sum_{i=1}^{0.5n} i$$ if $n$ is even, or

$$2\sum_{i=1}^{0.5(n-1)}(i) + \lceil n/2 \rceil$$ if $n$ is odd

Where $\lceil n \rceil$ is the ceiling function

0
On

For $n=1$ and $n=2$, we find costs $f(1)=1$ and $f(2)=2$ By direct computation. We obtain the cost for $n+2$ items from the cost for $n$ items by increasing the cost for each of the $n$ items by $1$ and then prepending and appending an item each of cost $1$. Therefore $$\tag1 f(n+2)=f(n)+n+2.$$
By inspecting a few small values of $n$, you may make the guess that $$\begin{align}f(2k-1)&=k^2\\f(2k)&=k^2+k\end{align} $$ and once you have this (valid) guess, prove it by induction using $(1)$.