x i is a permutation of { 1 , 2 , … , 4 0 2 } . What is the largest value of S = ∣ … ∣ ∣ ∣ x 1 − x 2 ∣ − x 3 ∣ − x 4 ∣ − … − x 4 0 2 ∣ ?
Details and assumptions
∣ ⋅ ∣ is the absolute value function, which satisfies
∣ x ∣ = { x − x x ≥ 0 x < 0
For example, ∣ 5 ∣ = 5 , ∣ − 7 ∣ = 7 .
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.
Let A k = { 0 , 1 , … , k } for any k . Set some positive integer n ≡ 2 ( m o d 4 ) . Let s 2 = ∣ x 1 − x 2 ∣ and s i + 1 = ∣ s i − x i + 1 ∣ . Note that if a , b ∈ A , then ∣ a − b ∣ ∈ A . Thus ∣ x 1 − x 2 ∣ ∈ A , ∣ ∣ x 1 − x 2 ∣ − x 3 ∣ ∈ A ,... it follows by induction on the terms of S = s n that S ∈ A . Thus S ≤ n .
We prove S = n . Suppose S = n . Then { s n − 1 , x n = { 0 , n } . But s n − 1 cannot be n , otherwise x n = n and { x 1 , x 2 , … , x n − 1 } = { 1 , 2 , … , n − 1 } and thus s n − 1 ≤ n − 1 , absurd. Thus s n − 1 = 0 . Since n − 1 ≡ 1 ( m o d 4 ) , A n − 1 contains oddly many odd numbers.
Suppose x n − 1 is even. Then { x 1 , … , x n − 2 } contains oddly many odd numbers, and thus s n − 2 is odd. But 0 = s n − 1 = ∣ s n − 2 − x n − 1 ∣ and since x n − 1 is even, 0 is odd, contradiction. The other case is analogous. Suppose x n − 1 is odd. Then { x 1 , … , x n − 2 } contains evenly many odd numbers, and thus s n − 2 is even. But 0 = s n − 1 = ∣ s n − 2 − x n − 1 ∣ and since x n − 1 is odd, 0 is odd, contradiction again.
It follows that S ≤ n − 1 . We prove that this is achievable. Consider ( x 1 , x 2 , … , x n ) = ( n − 1 , n − 2 , … , 3 , 2 , 1 , n ) . I claim it works. Note that ∣ ∣ ∣ ( k + 4 ) − ( k + 3 ) ∣ − ( k + 2 ) ∣ − ( k + 1 ) ∣ = 0 for all k . It follows that in this case s n − 2 = 0 (recall n ≡ 2 ( m o d 4 ) ), which implies s n − 1 = 1 and S = s n = n − 1 . Since 4 0 2 ≡ 2 ( m o d 4 ) , we easily find the answer to be 4 0 1 , as desired.
I use the notation s i for partial results, with s 1 = x 1 . s i + 1 = ∣ s i − x i + 1 ∣ , so S = s 4 0 2 .
∣ y 1 − y 2 ∣ is at least 0 and at most m a x ( y 1 , y 2 ) , so all partial results in the evaluation of S are in [0,402]. The largest number we can possibly achieve is thus 402. This can happen if ∣ . . . ∣ x 1 − x 2 ∣ − . . . − x 4 0 1 ∣ = 0 .
Consider odd and even numbers. If y 2 is even, the result of ∣ y 1 − y 2 ∣ is odd or even according to whether y 1 is odd or even. If y 2 is odd, the result of ∣ y 1 − y 2 ∣ is even or odd according to whether y 1 is odd or even. In other words, doing the operation of subtracting y 2 and taking the absolute value leaves the parity unchanged if y 2 is even and changes it if y 2 is odd. The odd numbers in the set are 1, 3, ... 401, which is 201 numbers. The final parity of S is therefore odd, and cannot be 402. It can be 401, however.
Let x 4 0 2 = 4 0 2 , x 1 = 1 , and the other x i = 4 0 3 − i . Then ∣ x 1 − x 2 ∣ = ∣ 1 − 4 0 1 ∣ = 4 0 0 . ∣ 4 0 0 − 4 0 0 ∣ = 0 . ∣ 0 − 3 9 9 ∣ = 1 . ∣ 1 − 3 9 8 ∣ = 3 9 7 . This pattern continues, so that s 4 j + 1 = 1 for natural numbers j. S = ∣ s 4 0 1 − 4 0 2 ∣ . 401 is expressible as 4 j + 1 , so s 4 0 1 = 1 , and therefore S = 401.
I claim that 401 is the largest. Clearly, this is less than or equal to 402, and integral. By a simple parity argument, we have that this is odd, so it must be <= 401. To attain this, we need x 4 0 2 = 4 0 2 and ∣ . . . ∣ x 1 − x 2 ∣ − x 3 ∣ − . . . − x 4 0 1 ∣ = 1 . Lemma: There exists a permutation x i of {1,2, \cdots 4k+1 such that ∣ ⋯ ∣ x 1 − x 2 ∣ − ⋯ − x 4 k + 1 ∣ = 1 . Proof: Induction. When k = 0, this is obvious. Inductive step. Assume this is true for k = i-1. Then we can just let x 4 k − 2 = 4 k + 1 , x 4 k − 1 = 4 k , x 4 k = 4 k − 1 , and x 4 k + 1 = 4 k − 2 , so ∣ ∣ ∣ ∣ ⋯ ∣ x 1 − x 2 ∣ − ⋯ − x 4 k − 2 ∣ − x 4 k − 1 ∣ − x 4 k ∣ − x 4 k + 1 ∣ = ∣ ∣ ∣ ∣ 1 − ( 4 k + 1 ) ∣ − 4 k ∣ − ( 4 k − 1 ) ∣ − ( 4 k − 2 ) = ∣ ∣ ∣ 4 k − 4 k ∣ − ( 4 k − 1 ) ∣ − ( 4 k − 2 ) ∣ = ∣ 4 k − 1 − ( 4 k − 2 ) ∣ = 1 . Thus 1 is attainable. This implies that 401 is attainable for the original expression, so the maximum value is 401.
Group 2-401 as (2,3,4,5), (6,7,8,9), ……(398,399,400,401) to make 0, then |1-402|=401. By module 2 the answer is odd and is <=402.
Since ∣ x − y ∣ ≤ max { x , y } , we get that S ≤ 4 0 2 . Since ∣ x − y ∣ has the same parity as x + y , it follows that S has the same parity as 1 + 2 + … + 4 0 1 = 2 1 ( 4 0 2 ) ( 4 0 3 ) , so S is odd. Thus S ≤ 4 0 1 .
To show that this is possible, use the permutation
x i = ⎩ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎧ 4 k + 2 4 k + 4 4 k + 5 4 k + 3 4 0 2 1 i = 4 k + 1 , k < 1 0 0 i = 4 k + 2 , k < 1 0 0 i = 4 k + 3 , k < 1 0 0 i = 4 k + 4 , k < 1 0 0 i = 4 0 1 i = 4 0 2
In this case, S = 4 0 1 , hence that is the maximum value.
Problem Loading...
Note Loading...
Set Loading...
Consider parity. Since the parity of ∣ x − y ∣ is the same as x + y , it follows that S must be odd. Since ∣ x − y ∣ ≤ max ( x , y ) for non-negative numbers, it follows that S ≤ 4 0 2 . Hence, 401 is the maximum number possible.
Then, we note that ∣ ∣ ∣ ∣ n − ( n − 1 ) ∣ − ( n − 2 ) ∣ − ( n − 3 ) ∣ =0. Thus we have ∣ ∣ ∣ . . . ∣ ∣ 4 0 1 − 4 0 0 ∣ − 3 9 9 ∣ − . . . − 2 ∣ − 1 ∣ − 4 0 2 ∣ = ∣ ∣ ∣ . . . ∣ ∣ ∣ 0 − 3 9 7 ∣ − 3 9 6 ∣ − 3 9 5 ∣ − . . . − 2 ∣ − 1 ∣ − 4 0 2 ∣ = . . . = ∣ ∣ 0 − 1 ∣ − 4 0 2 ∣ = 4 0 1 .
So 401 is attainable, and we are done.