Freddy removes four consecutive even numbers from the set $\{1,2,3,\ldots,n\}$. Freddy then computes $51.5625$ as the average of the remaining $n-4$ numbers.
Which four even numbers did Freddy remove?
Puzzling Stack Exchange is a question and answer site for those who create, solve, and study puzzles. It only takes a minute to sign up.
Sign up to join this communityNote: 51.5625 = 825/16
To calculate the sum for a given $n$ we can do $\frac{n \cdot (n+1)}{2}$.
Then we need to have that $\frac{n \cdot (n+1)}{2} - \frac{825 \cdot (n - 4)}{16}$ is a number that can be expressed as four even consecutive numbers.
Let $x$ be the lowest of the four consecutive numbers.
The four even consecutive numbers are of the form $x+x+2+x+4+x+6= 4x + 12$.
This means that
$$\frac{\frac{n \cdot (n+1)}{2} - \frac{825 \cdot (n - 4)}{16}-12}{4}$$ must be an positive even integer and is equal to $x$
We can find then that $n=100$ is the first solution giving the result 22. But we also find out that there are an unlimited number of solutions which are all of the form $n = 100 + 128k$ for any positive integer $k$. The first couple of solutions are for example:
n | x |
---|---|
100 | 22 |
228 | 3636 |
356 | 11356 |
484 | 23152 |
EDIT: As Tim Couwelier pointed out, the four consecutive numbers of course cannot exceed $n$, therefore the solution with $n=100$ is the only solution
sum of:
{1,2,3,4,...,100} 1 to 100 = 5050
we need to know avg of n-4
51.5625 x 96 = 4950
so sum of 4 numbers must be:
5050 - 4950 = 100 , n+n+2+n+4+n+6 = 100 which is n = 22
numbers to be removed are :
22,24,26,28
22 24 26 28
Calculations:
We know the average to be 51.5625, of 825/16.
To try and end up with that fraction, we need to see where the sum of the first n integers is high enough to create a possible solution.
For n = 20, sum is only 210, so no chance of approaching 825/16
For n = 36, sum is 666, so no chance of approaching 1650/32.
For n = 52, sum is 1378, so no chance of approaching 2475/48
For n = 68, sum is 2346, so no chance of approaching 3300/64
For n = 84, sum is 3570. so no chance of approaching 4125/80
For n = 100, sum is 5050. We are looking for 4950/96, so this could have a possible solution.
Given we have a total sum of 5050 over de first 100 integers, and we only need 4950 from 96 numbers, we need to find which four consecutive integers add up to 100. Knowing the average is 25, it's fairly trivial to find 22 24 26 28 as the series to be removed.
N=100 and terms are: 22,24,26,28.
As we know that $ \sum_{i=1}^n i $ $=$ $ \frac{n*(n+1)}{2} $
Thus, average $\mu_1$ = $ \frac{(n+1)}{2} $
Given, four consecutive even numbers are removed. So, let the first number of the series be $x$, thus the next three are: $ x+2, x+4, x+6$.
Their sum is: $4(x+3)$.
As we can see that, the new SUM of $n-4$ terms is :
$\frac{n*(n+1)}{2}-4(x+3)$
which is :
$\frac{n*(n+1)-8(x+3)}{2}$
Also, the new mean/average of remaining terms is $51.5625$ or $\frac{825}{16}$. And the $\mu_2$ of $n-4$ terms :
$\frac{n*(n+1)-8(x+3)}{2(n+4)}$
Thus, :
$\frac{n*(n+1)-8(x+3)}{2(n+4)} = \frac{825}{16}$
or
$ 8*( n(n+1) - 8(x+3) ) = 825(n-4)$
An equation of two variable, which must have integral solution for $n \gt 4 $ and $x \gt 2 $.
I solved it using this (inefficient w.r.t Time complexity) code.