0
$\begingroup$

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.

$\endgroup$
2
  • 3
    $\begingroup$ solutionbinary = IntegerDigits[solution, 2, 3] $\endgroup$
    – Syed
    Feb 17, 2022 at 17:51
  • $\begingroup$ Yeah, It was asked mathematica.stackexchange.com/questions/146876/… it was hard to find the title of the question. I found it after posting the question. Thank you $\endgroup$
    – drorhun
    Feb 17, 2022 at 17:53

1 Answer 1

0
$\begingroup$

I saw the answer is in the question here

Answer:

  solutionbinary = IntegerDigits[solution, 2, 3]
$\endgroup$

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