Parity Situation?

x = a + b + c + d + e + f + a b c d e f \large x = a + b + c + d + e + f + abcdef

In the expression above, a a , b b , c c , d d , e e , and f f have values 1 1 or 1 -1 . How many distinct values can x x take?


The answer is 4.

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.

2 solutions

Kexin Zheng
May 26, 2016

We can make a table to list out all the possible combinations:

Prasun Biswas
May 27, 2016

First, note that since the expression x x is symmetric in terms of a , b , c , d , e , f a,b,c,d,e,f and we have a , b , c , d , e , f { 1 , 1 } a,b,c,d,e,f\in\{-1,1\} , the number of distinct values x x can take can be evaluated by just considering how many of a , b , c , d , e , f a,b,c,d,e,f are 1 -1 in x x .

Now, denote by x k x_k the value of x x if k k elements out of a , b , c , d , e , f a,b,c,d,e,f be 1 -1 . Then, x k = k ( 1 ) + ( 6 k ) ( 1 ) + ( 1 ) k = 6 2 k + ( 1 ) k x_k=k(-1)+(6-k)(1)+(-1)^k=6-2k+(-1)^k

Now, if k k is even, say k = 2 m k=2m , then we have x 2 m = 7 4 m x_{2m}=7-4m where m 0 m\geq 0

If k k is odd, say k = 2 m 1 k=2m-1 , then x 2 m 1 = 7 4 m x_{2m-1}=7-4m . So, we have x 2 m = x 2 m 1 x_{2m}=x_{2m-1} where m 1 m\geq 1

Furthermore, x 2 m < x 2 ( m + 1 ) x_{2m}\lt x_{2(m+1)} and x 2 m + 1 < x 2 ( m + 1 ) + 1 x_{2m+1}\lt x_{2(m+1)+1} when m 0 m\geq 0 .

So, we conclude that { x k } \{x_k\} is a non-increasing sequence with x 0 < x 1 = x 2 < x 3 = x 4 < x 5 = x 6 x_0\lt x_1=x_2\lt x_3=x_4\lt x_5=x_6 , so there are 4 4 distinct values in { x k } \{x_k\} and since x x takes values from { x k } \{x_k\} , there are 4 4 distinct values x x can take.


A bit more general result:

If x = a 1 + a 2 + + a n + a 1 a 2 a n x=a_1+a_2+\ldots+a_n+a_1a_2\cdots a_n where a i { 1 , 1 } 1 i n a_i\in\{1,-1\}~\forall~1\leq i\leq n , then x x can take n 2 + 1 \displaystyle\left\lceil\frac n2\right\rceil+1 distinct values and the set of these distinct values is { n + 1 4 i 0 i n 2 } \displaystyle\left\{n+1-4i\mid 0\leq i\leq\left\lceil\frac n2\right\rceil\right\} .

Moderator note:

Thanks for generalizing the result!

[N/2] +1 when N is even.....in case of n=11 it is not possible

Ankur Sharma - 5 years ago

Log in to reply

Are you sure about that? Do note that \lceil\cdot\rceil denotes the ceiling function , not the floor function . So, we have 11 / 2 = 6 \lceil 11/2\rceil=6 and not 5 5 which the floor function gives.

For n = 11 n=11 , we see that 11 2 + 1 = 5.5 + 1 = 6 + 1 = 7 \lceil\frac{11}2\rceil+1=\lceil 5.5\rceil+1=6+1=7 and indeed x x takes 7 7 distinct values, namely from the set { 12 , 8 , 4 , 0 , 4 , 8 , 12 } \{12,8,4,0,-4,-8,-12\} .

For verification, here's a little Python script I wrote just now that checks by brute force the number of distinct values x x takes.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from itertools import product
from functools import reduce
def prod(i):
    return reduce(lambda x,y:x*y, i)
def test(n):
    myset=set()
    for i in product([1,-1],repeat=n):
        myset|={sum(i)+prod(i)}
    print("Number of distinct values is",len(myset),"and the set is",myset)

test(int(input("Enter the value of n = ")))

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.

Prasun Biswas - 5 years ago

Log in to reply

okk got it...i was taking it floor function

Ankur Sharma - 5 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...