\[331 = x_0 + 2x_1 + 4x_2 + \color{red}{8x_3}+16x_4 + 32x_5 + 64x_6 + 128x_7 + 256x_8\] where \(x_i = 0 ~or~1\) Find a solution if it exists \(\color{Red}{EDIT} : \text{updated the missing term, thanks to Unkle} :)\)
oh gee
seems you know how to solve this problem :)
wait cant you just add these like terms first
the solve backwards
then*
this looks like 2 solutions because..
wait am i solving this or are you putting this out there and you already know the answer.
What like terms are there?
the x
I think those are different variables
add each variable(like terms) and then divide by non like terms
i think its two solutions
yes let me update the question :)
ok
Why write x_1 and x_2 and so on? I was thinking each subscript denoted a different variable
yes each subscript denotes a different variable
in this case am i using 0 or 1? does it matter.
The answer lies within your heart.
haha i think i need to give an example to make the problem more clear : Example : \(5 = x_1 + 2x_2 + 4x_3\) the solution is \(x_1 = 1,~x_2 = 0,~x_3 = 1\) because \(1 + 2(0) + 4(1) = 5\)
Ohhh I get it now
oh i was just reading this .. http://arxiv-web3.library.cornell.edu/pdf/1110.6620v3.pdf
its something similar
except more broad
did you miss 8 ?
The LHS is odd, so we must have \(x_1 = 1\). The remaining number is \(330\), and we have to check if we can express it in terms of the sum of powers of two. And there must be a 256 - otherwise our sum wouldn't be able to reach 330. The remaining sum is 74. It has come down to expressing 74 as a sum of powers of two. And we can certainly achieve that! \(74 = 64 + 8 + 2\). Therefore, \(331 = 1 + 2 + 8 + 64 + 256\). The other terms are zero.
**assuming that there is an 8 in the sum, that is.
If there is not an 8 in the sum, then we can claim that it is in fact impossible to find a solution, because I can't see any other way to express 74 as the sum of powers of two.
Sorry yes I did miss the 8 :/ PK looks good :)
So it is a unique solution, yes?
\[\sum_{i=0}^82^ix_i=\begin{bmatrix}2^0&2^1&2^2&2^3&2^4&2^5&2^6&2^7&2^8\end{bmatrix}\begin{bmatrix}x_0\\x_1\\x_2\\x_3\\x_4\\x_5\\x_6\\x^7\\x_8\end{bmatrix}\]
that looks more like "binary number system" now XD
indeed
so the answer to PK's question should be yes there is an one-to-one mapping because each decimal number has an unique binary representation and each binary number has an unique decimal representation
Ohhhh, I didn't think of it that way. Yeah.
Actually it can be shown easily that every super increasing series has an unique solution : \[N = a_0x_0 + a_1x_1 + a_2x_2 + \cdots + a_{n-1}x_{n-1}+a_nx_n \] if exists, there exists an unique solution provided \(a_i \gt a_0+a_1+\cdots + a_{i-1}\)
A simle example of superincreasing sequence is \(\{1,~2, ~4, ~8,~\ldots~, 2^n\}\) where \(2^i \gt 2^{i}-1 = 1+2+4+\cdots + 2^{i-1}\)
That's cool. What does \(\{ x_n \}\) signify? Ones and zeroes?
yes missed that detail : \(x_i = 0/1\)
there are pretty interesting problems based on this unique solution criterion http://en.wikipedia.org/wiki/Superincreasing_sequence
That is an interesting fact. I haven't studied number theory or whatever field this is, so I'm wondering how we can even prove this.
Can we separate the "power" terms from the general term so as to prove it for general super-sequences?
Proving is a bit theoretic.. so its not so interesting ;) but there is an amaging application of this property : it allows two people to communicate securely in a not so safe medium. For example, using that property a bunch of people can communicate by writing letters to each other through postal service without worrying about compromising the security
this is like asking find the binary of 331
Yes exactly !
I was talking about below encryption algorithm http://en.wikipedia.org/wiki/Merkle%E2%80%93Hellman_knapsack_cryptosystem but its really easy, idk why wiki is trying hard to make it complicated
you could prove the general case for \(n\) with induction,
Induction works pretty neatly. The textbook i am refering to has this proof/general solution which can be a bit enlightnenign : \[N = a_0x_0 + a_1x_1 + a_2x_2 + \cdots + a_{n-1}x_{n-1}+a_nx_n\] Assuming there exists a solution to above, the solution is given by \[x_i = \left\{\begin{array}{}1& \text{if }N-(a_{i+1}x_{i-1}+\cdots+a_nx_n)\ge a_i\\ 0& \text{if }N-(a_{i+1}x_{i-1}+\cdots+a_nx_n)\lt a_i\\ \end{array}\right.\]
So just a question, doesn't this whole thing just depend on if x_0=1?
I think so... \(x_0 = 0/1\) depending on \(N\) being even or odd... it was stated by PK earlier..
whats a good way to see the highest power of 2 that can go into your number
whats the function for log?
is there a better way can to floor log function
than * to
But it has to equal 1
Oh right we need to work the highest power that goes into N as the solution is wokring from right hand side
It's also a prime factorization
yeah
question is, does 330 have a prime factorization that only contains twos?
because 256 < 330 < 512, we pick \(x_8 = 1\) and \(x_9=0\)
I feel you are overcomplicating it
yeah that how u wud go about generating binary numbers fast
there might be a more efficient way
I am just working the step given in proof above
decimal to binary conversion ?
yaa
oh, For this particular problem I would just do a prime factorization on 330, realize it's not all twos then disprove possibility of a solution
it's like a 4-5 step disprove
all numbers below 512 are possible though
oh, I'm thinking of straight multiplication, not the addition
dang
its just the decimal way of writing out binary numbers so, everything below the next highest power of 2 is possible
using 9 bits we can represent number between 0 and 2^9-1
2 = (10)_2 2^2 = (100)_2 2^3 = (1000)_2 ... like this ? this is efficient for computer to work.. but still it wont tell us 2^n = what in decimal form right ?
yea yea I see where I misinterpreted
you can type up an algorithm
yee lets goo
basically convert the base to binary and left shift to increase the exponent
yea
or google haha 101001011
So your problem has no solution. The solution requires an x_9
hey is there a way to do log base 2 stuff with only lns
uhm, you would have to do a conversion. So convert all log base twos into ln.
you're trying to work below efficiently ? \[2^? = N\]
ya i wanna do floor(log_2_(N)) but matlab only allows Ln
we can use change of base as fib said right ? log_2 (N) = ln(N)/ln(2)
you remember how in calc to do other logs we used the change of base formula?
That would be how I'd approach it at least
why does that give u change of base again
@Jhannybean hii
haha I never proved it. But it does
hahaha
i remember doing it on here a while ago
@ganeshie8 heyyyyy . Heading off OS for a while again. See you guys soon :)
Hey Jhanny!!!! Nice to see ya again, have fun!
|dw:1425708303756:dw|
Join our real-time social learning platform and learn together with your friends!