Averaging neighbours in a list

109 Views Asked by At

In a list of twelve numbers, the first number is 1 and the last number is 12.

1, a, b, c, d, e, f, g, h, i, j, 12 (assume the letters represent unknown numbers)

Each other number in the list is calculated by taking the average of its neighbours and adding 1. The question is asking to find the largest number in this list.

I have assumed the third number of the list to be x, then the second number can be calculated in terms of x:

1, $\frac{x+1}{2} + 1$, x

Continuing this process I got:

$1$, $\frac{x+3}{2}$, $x$, $\frac{3x-7}{2}$, $2x - 9$, $\frac{5x-33}2$, $3x - 26$, $\frac{7x-75}2$, $4x - 51$, $\frac{9x-133}2$, $5x - 84$, $12$

I found that x is equal to 21 and the biggest number in the list is 37.

This method took a long time and is inefficient. Is there any better way to do this?

1

There are 1 best solutions below

2
On BEST ANSWER

if $x, y, z$ are three adjacent numbers, then $y = 1 + \frac{x+z}2$, which solves to $$z = 2y - x - 2$$

Also, let me call the values as $$1, a_1 = t, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_{10}, 12$$

Thus we can calculate

  • $a_0 = 1 = 0t + 1$
  • $a_1 = t - 0$
  • $a_2 = 2t - 3$
  • $a_3 = 2a_2 - a_1 - 2 = 3t-8$
  • $a_4 = 2a_3 - a_2 - 2 = 4t - 15$
  • $a_5 = 2a_4 - a_3 - 2 = 5t -24$

From which it appears that $$a_n = nt - n^2 +1$$ If this holds $a_n$ and $a_{n-1}$ then $$\begin{align}a_{n+1} &= 2a_n - a_{n-1} - 2\\ &=2(nt - n^2 +1) - ((n-1)t - (n-1)^2 + 1) - 2\\ &=[2nt-(n-1)t] - [2n^2 - (n-1)^2 + 1] +[2 - 2]\\ &=[(n+1)t] - [n^2 + 2n]\\ &=(n+1)t - (n+1)^2 + 1\end{align}$$ And thus by induction, this holds for the remaining values, including $a_{11} = 12$.

So $$11t - 11^2 + 1 = 12\\t - 11 = 1\\t = 12$$ And we can calculate $$a_1 = 12 - 0 = 12\\ a_2 = 24 - 3 = 21\\ a_3 = 36 - 8 = 28\\ a_4 = 48 - 15 = 33\\ a_5 = 60 - 24 = 36\\ a_6 = 72 - 35 = 37\\ a_7 = 84 - 48 = 36\\ a_8 = 96 - 63 = 33\\ a_9 = 108 - 80 = 28\\ a_{10} = 120 - 99 = 21\\ a_{11} = 132 - 120 = 12$$