# How do I remove the subscript after calling BaseForm[]?

Say I want to convert some number $N$ to base $k$. Here, I might use the command BaseForm[N,k], e.g.,BaseForm[10,2] which gives the output 1010[2] (where [2] is subscript). How can I drop the subscript and manipulate the number as if it is a normal integer in decimal form? I'd ideally like to do this without any string processing?

-

Don't use BaseForm[number,base]

Use IntegerDigits[number,base] :

IntegerDigits[10, 2]

(* --->  {1, 0, 1, 0} *)


It returns a List of Integers, which is a very good thing for further processing

-
@Mr.Wizard This is more than enough, thanks! –  MultiVerb Feb 25 '13 at 16:33
Oh, I misunderstood the format. Thank you andre! Mr. Wizard also :) –  MultiVerb Feb 26 '13 at 5:15

You could do something like this:

toBaseString[n_?NumericQ, b_Integer?Positive] :=
First @ StringSplit @ ToString @ BaseForm[n, b]

toBaseString[365.7, 5]

"2430.32222"


I missed that you didn't want strings. Perhaps you want this?:

toBasePlain[n_?NumericQ, b_Integer] /; 11 > b > 0 :=
N @ FromDigits @ RealDigits[n, b]

toBasePlain[365.7, 5] // InputForm

2430.322222222222
`
-
It seems I was way off the mark but I'll leave this answer for anyone who finds this question through a search and may want something else. –  Mr.Wizard Feb 25 '13 at 16:38