Re: Converting Binary form to a desired array
- To: mathgroup at smc.vnet.net
- Subject: [mg76068] Re: Converting Binary form to a desired array
- From: dh <dh at metrohm.ch>
- Date: Tue, 15 May 2007 05:08:33 -0400 (EDT)
- References: <f2959d$n0n$1@smc.vnet.net>
Hello Sharon, one way to do it is to multiply an array of binary powers (2^i..) by the binary digits of your number. E.g.: (t=IntegerDigits[212,2]) ( HoldForm[2^i]/.i\[Rule]#& /@ Range[Length[t]-1,0,-1]) hope this helps, Daniel athlonspell wrote: > Hello, > > I have this: > >> BaseForm[212,2] = 10100 > > Now, I am trying to achieve this output from above: > >> {2^4, 0, 2^2, 0, 0} > > How do I go about do this? > > Thank you, > Sharon >