∣ x − 1 ∣ + ∣ x − 2 ∣ + ∣ x − 3 ∣ + ⋯ + ∣ x − 2 0 1 6 ∣ + ∣ x − 2 0 1 7 ∣
Find the number of positive factors of the minimum value of the above expression?
Notation: ∣ ⋅ ∣ denotes the absolute value function.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
For a set S with n elements such that s 1 < s 2 < ⋯ < s n , s ∈ S ∑ ∣ x − s ∣ is minimized when x is the median of S .
Let's show this intuitively before proving it rigorously.
Intuition
Imagine the given values as trees along a road. The quantity you are trying to minimize is the sum of distances between you and each of the trees.
Suppose that you are standing at the median, and you know the current value of the sum. How will it change if you move in either direction? Note that regardless of which direction you choose, in each moment you will be moving away from at least half of the trees, and towards at most half of the trees. Therefore, the sum of distances can never decrease -- and that means the sum of distances at the beginning had to be optimal.
Proof
Suppose that the set S has n elements, s 1 < s 2 < ⋯ < s n . If x < s 1 , then
f ( x ) = s ∈ S ∑ ∣ x − s ∣ = s ∈ S ∑ ∣ s − x ∣ = s ∈ S ∑ ( s − x ) = k = 1 ∑ n ( s k − x )
As x increases, each term of f ( x ) decreases until x reaches x 1 , so f ( s 1 ) < f ( x ) for all x < s 1 .
Now suppose that s k ≤ x ≤ x + d ≤ s k + 1 . Then
f ( x + d ) = i = 1 ∑ k ( x + d − s i ) + i = k + 1 ∑ n ( s i − ( x + d ) ) = d k + i = 1 ∑ k ( x − s i ) − d ( n − k ) + i = k + 1 ∑ n ( s i − x ) = d ( 2 k − n ) + i = 1 ∑ k ( x − s i ) + i = k + 1 ∑ n ( s i − x ) = d ( 2 k − n ) + f ( x )
so f ( x + d ) − f ( x ) = d ( 2 k − n ) . This is negative if 2 k < n , zero if 2 k = n , and positive if 2 k > n . Thus, on the interval [ s k , s k + 1 ] ,
f ( x ) is ⎩ ⎪ ⎨ ⎪ ⎧ decreasing, constant, increasing, if 2 k < n if 2 k = n if 2 k > n
In particular, we note that when 2 k = n , the sum stays constant. What this translates to for our tree analogy is that the sum of the distances does not "tend" toward one direction or another. Finally, we note that since 2 k = n , k is the median of our set S .
Thus, we have proven that for a set S with n elements such that s 1 < s 2 < ⋯ < s n , s ∈ S ∑ ∣ x − s ∣ is minimized when x is the median of S . Now let's work through the problem.
f ( x ) = ∣ x − 1 ∣ + ∣ x − 2 ∣ + ∣ x − 3 ∣ + ⋯ + ∣ x − 2 0 1 6 ∣ + ∣ x − 2 0 1 7 ∣ = n = 1 ∑ 2 0 1 7 ∣ x − n ∣
f ( x ) is minimized when x is the median of the set S = { 1 , 2 , 3 , … 2 0 1 6 , 2 0 1 7 } . Since S is a uniform distribution, the median equals the mean of the set, so the median is x = 2 1 + 2 0 1 7 = 1 0 0 9 . We have
f ( 1 0 0 9 ) = n = 1 ∑ 2 0 1 7 ∣ 1 0 0 9 − n ∣ = 2 n = 1 ∑ 1 0 0 9 ( 1 0 0 9 − n ) = 2 n = 1 ∑ 1 0 0 9 1 0 0 9 − 2 n = 1 ∑ 1 0 0 9 n = ( 2 ⋅ 1 0 0 9 ⋅ 1 0 0 9 ) − ( 2 ⋅ 2 1 0 0 9 ⋅ 1 0 1 0 ) = 1 0 0 8 ⋅ 1 0 0 9 = 2 4 ⋅ 3 2 ⋅ 7 ⋅ 1 0 0 9
The number of factors of f ( 1 0 0 9 ) is ( 4 + 1 ) ( 2 + 1 ) ( 1 + 1 ) ( 1 + 1 ) = 6 0 .
WOW!!! Great insight...
Let S ( n ) = k = 1 ∑ n ∣ x − k ∣ . Then we have:
⟹ S ( 2 0 1 7 ) = 1 0 0 8 ( 1 0 0 9 ) = 2 4 × 3 2 × 7 × 1 0 0 9 . The number of factors is ( 4 + 1 ) ( 3 + 1 ) ( 1 + 1 ) ( 1 + 1 ) = 6 0 .
Problem Loading...
Note Loading...
Set Loading...
It is elementary that f ( x ) = ∣ x − a ∣ + ∣ x − b ∣ is constant for a ≤ x ≤ b , and is certainly minimized at x = 2 1 ( a + b ) .
Thus each of the functions ∣ x − 1 ∣ + ∣ x − 2 0 1 7 ∣ , ∣ x − 2 ∣ + ∣ x − 2 0 1 6 ∣ , ∣ x − 3 ∣ + ∣ x − 2 0 1 5 ∣ , ... , ∣ x − 1 0 0 8 ∣ + ∣ x − 1 0 1 0 ∣ , as well as the function ∣ x − 1 0 0 9 ∣ , are minimized at x = 1 0 0 9 . Thus the minimum value of the function ∣ x − 1 ∣ + ∣ x − 2 ∣ + ⋯ + ∣ x − 2 0 1 7 ∣ occurs at x = 1 0 0 9 , and is 2 ( 1 + 2 + ⋯ 1 0 0 8 ) + 0 = 1 0 0 8 × 1 0 0 9 = 2 4 × 3 2 × 7 × 1 0 0 9 a number which has 5 × 3 × 2 × 2 = 6 0 positive factors.