Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why do the following not work (in Mathematica 7)?

2^^ # & /@ {1000, 1101}


2^^ # & @ 1101

This does work:


giving, as expected:


(This also works:

BaseForm[#, 2] & /@ {13, 14}


See here for further information ("Digits in numbers")

share|improve this question
Note that 2^^ 1101 doesn't work either, which already is a strong hint that one shouldn't expect 2^^ # & to work. – celtschk May 24 '12 at 12:12
I like how in MMA questions can appear to be censored curse words. What the F^^@@#? – yohbs May 24 '12 at 13:24
up vote 12 down vote accepted

The reason is that the notation base^^digits is interpreted at parsing time, not evaluation time. I explained the difference in this answer.

You can use FromDigits instead:

fromBaseTwo = FromDigits[#, 2]& 


Note that I used a string as input. FromDigits works both with strings and lists of digits.

share|improve this answer
I feel that this previous question says it all. Vote to close this one? – Sjoerd C. de Vries May 24 '12 at 11:13
@Sjoerd Personally I'm fine with closing. Maybe the FromDigits part (how to actually construct that pure function) is a worthwhile addition here? – Szabolcs May 24 '12 at 11:16
Didn't we cover that here? – Sjoerd C. de Vries May 24 '12 at 11:49
@Sjoerd I did consider voting to close briefly, before posting an answer, but for some reason I didn't. Just do what you feel is correct :-) – Szabolcs May 24 '12 at 14:26
I wish I could just vote to close without casting a super close vote. I'm hesitating because of this pure function part in the question, but actually it doesn't make much of a difference. – Sjoerd C. de Vries May 24 '12 at 14:36

Here is a somewhat messed-up way to do something like what you wanted to do:

ToExpression["2^^" <> ToString[#]] & /@ {1000, 1101}
{8, 13}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.