x = a + b + c + d + e + f + a b c d e f
In the expression above, a , b , c , d , e , and f have values 1 or − 1 . How many distinct values can x take?
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.
First, note that since the expression x is symmetric in terms of a , b , c , d , e , f and we have a , b , c , d , e , f ∈ { − 1 , 1 } , the number of distinct values x can take can be evaluated by just considering how many of a , b , c , d , e , f are − 1 in x .
Now, denote by x k the value of x if k elements out of a , b , c , d , e , f be − 1 . Then, x k = k ( − 1 ) + ( 6 − k ) ( 1 ) + ( − 1 ) k = 6 − 2 k + ( − 1 ) k
Now, if k is even, say k = 2 m , then we have x 2 m = 7 − 4 m where m ≥ 0
If k is odd, say k = 2 m − 1 , then x 2 m − 1 = 7 − 4 m . So, we have x 2 m = x 2 m − 1 where m ≥ 1
Furthermore, x 2 m < x 2 ( m + 1 ) and x 2 m + 1 < x 2 ( m + 1 ) + 1 when m ≥ 0 .
So, we conclude that { x k } is a non-increasing sequence with x 0 < x 1 = x 2 < x 3 = x 4 < x 5 = x 6 , so there are 4 distinct values in { x k } and since x takes values from { x k } , there are 4 distinct values x can take.
A bit more general result:
If x = a 1 + a 2 + … + a n + a 1 a 2 ⋯ a n where a i ∈ { 1 , − 1 } ∀ 1 ≤ i ≤ n , then x can take ⌈ 2 n ⌉ + 1 distinct values and the set of these distinct values is { n + 1 − 4 i ∣ 0 ≤ i ≤ ⌈ 2 n ⌉ } .
Thanks for generalizing the result!
[N/2] +1 when N is even.....in case of n=11 it is not possible
Log in to reply
Are you sure about that? Do note that ⌈ ⋅ ⌉ denotes the ceiling function , not the floor function . So, we have ⌈ 1 1 / 2 ⌉ = 6 and not 5 which the floor function gives.
For n = 1 1 , we see that ⌈ 2 1 1 ⌉ + 1 = ⌈ 5 . 5 ⌉ + 1 = 6 + 1 = 7 and indeed x takes 7 distinct values, namely from the set { 1 2 , 8 , 4 , 0 , − 4 , − 8 , − 1 2 } .
For verification, here's a little Python script I wrote just now that checks by brute force the number of distinct values x takes.
1 2 3 4 5 6 7 8 9 10 11 |
|
Here's the output:
Enter the value of n = 11
Number of distinct values is 7 and the set is {0, -4, 4, -12, 8, 12, -8}
Indeed, this matches with the generalized result in my solution.
Problem Loading...
Note Loading...
Set Loading...
We can make a table to list out all the possible combinations: