0

Let's say I have a list called 'solution', I'm converting these numbers into binary form

solution = {0, 6, 4, 7, 1, 3, 5, 2}
solutionbinary = IntegerDigits[solution, 2]

Output like:

{{0}, {1, 1, 0}, {1, 0, 0}, {1, 1, 1}, {1}, {1, 1}, {1, 0, 1}, {1, 0}}

My expectation:

{{0,0,0}, {1, 1, 0}, {1, 0, 0}, {1, 1, 1}, {0,0,1}, {0,1, 1}, {1, 0, 1}, {0,1, 0}}

All of them must be 3 digits binary form.

drorhun
  • 113
  • 4
  • 3
    solutionbinary = IntegerDigits[solution, 2, 3] – Syed Feb 17 '22 at 17:51
  • Yeah, It was asked https://mathematica.stackexchange.com/questions/146876/printing-binary-numbers-with-extra-zerosbut it was hard to find the title of the question. I found it after posting the question. Thank you – drorhun Feb 17 '22 at 17:53

1 Answers1

0

I saw the answer is in the question here

Answer:

  solutionbinary = IntegerDigits[solution, 2, 3]
drorhun
  • 113
  • 4