5

I have the numbers $0-64$ in binary and want them all to be displayed with 8 figures.

Expected output:

$5_{10} = 101_2$ should become 00000101.

Dennis Williamson
  • 103
  • 1
  • 1
  • 3
GambitSquared
  • 2,311
  • 15
  • 23

2 Answers2

7

It's unclear in your question if you are asking for a String for NumberForm.

FORM

If you want to change the Form but not create a string then

NumberForm[BaseForm[Range[0, 64], 2], 8, NumberPadding -> {"0", "0"}]

Mathematica graphics

you could define a function

bin8[n_Integer] := NumberForm[
  BaseForm[n, 2]
  , 8
  , NumberPadding -> {"0", "0"}
  ]

bin8 /@ Range[0, 64]

And get the same output

STRING

As pointed out by @swish

IntegerString[Range[0, 64], 2, 8]

Mathematica graphics

rhermans
  • 36,518
  • 4
  • 57
  • 149
3

how about

Row /@ Tuples[{0, 1}, 8][[;; 65]]

{00000000,00000001,00000010,00000011,00000100,00000101,00000110,00000111,00001000,00001001,00001010,00001011,00001100,00001101,00001110,00001111,00010000,00010001,00010010,00010011,00010100,00010101,00010110,00010111,00011000,00011001,00011010,00011011,00011100,00011101,00011110,00011111,00100000,00100001,00100010,00100011,00100100,00100101,00100110,00100111,00101000,00101001,00101010,00101011,00101100,00101101,00101110,00101111,00110000,00110001,00110010,00110011,00110100,00110101,00110110,00110111,00111000,00111001,00111010,00111011,00111100,00111101,00111110,00111111,01000000}

ZaMoC
  • 6,697
  • 11
  • 31