Re: Converting Binary form to a desired array

*To*: mathgroup at smc.vnet.net*Subject*: [mg76064] Re: Converting Binary form to a desired array*From*: Bill Rowe <readnewsciv at sbcglobal.net>*Date*: Tue, 15 May 2007 05:06:31 -0400 (EDT)

On 5/14/07 at 5:51 AM, szhorvat at gmail.com (Szabolcs) wrote: >athlonspell wrote: >>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? >Reverse@MapIndexed[#1 Superscript[2, First@#2] &, >Reverse@IntegerDigits[212, 2]] Close, but not quite there. Remember Mathematica indexes starting with 1 but the powers needed will be indexed starting with 0. So, Reverse@MapIndexed[#1 Superscript[2, First@#2-1] &, Reverse@IntegerDigits[212, 2]] is needed -- To reply via email subtract one hundred and four