I need to convert base 10 number say a in base 2 say b and want that, from now b must be read as a base 10 number. In general, I need to convert base 10 number say a in base n say b and want that, from now b must be read as a base 10 number. how to do this? whats the commands or programme for this?
Asked
Active
Viewed 46 times
0
-
2BaseForm and IntegerDigits should be helpful here. – Sjoerd C. de Vries Sep 12 '15 at 21:48
-
5http://mathematica.stackexchange.com/questions/88288/how-to-do-binary-calculation/88290#88290 – Enrique Pérez Herrero Sep 12 '15 at 22:58
1 Answers
1
If I understand your question
a = RandomInteger[10^5]
(* 60550 *)
BaseForm[a, 2]
b = FromDigits[IntegerDigits[a, 2]]
(* 1110110010000110 *)
Bob Hanlon
- 157,611
- 7
- 77
- 198
