if were only allowed to use >>, -, + to make a number X times the constant K lets assume K is 17 and K is 20 how to make an expression for each
I was trying to think of ways to do this but I cant.
|
if were only allowed to use >>, -, + to make a number X times the constant K lets assume K is 17 and K is 20 how to make an expression for each I was trying to think of ways to do this but I cant. |
|||||||
|
|
If $a$ is expressed in binary $$2^n\cdot a=a<<n$$ where $<<$ is the bitwise left shift operator. $$17\cdot a=(2^4+1)\cdot a=(a<<4)+a$$ and $$20\cdot a=(2^4+2^2)\cdot a=(a<<4)+(a<<2)$$ |
||||
|
|