FromDigits will convert a list to a number, i.e.

FromDigits[{5, 1, 2, 8}]
> 5128

Now, I want to convert 5128 back to a list, e.g {5,1,2,8}

How do I do that (particularly with a 5000 character long integer)?

  • 2
    $\begingroup$ Always have a look at the "See Also" section in the footer of the documenation of a built-in symbol. In this case, IntegegerDigits is the first entry in that section. $\endgroup$ – Henrik Schumacher Dec 18 '18 at 12:01
  • $\begingroup$ Sorry, "FromDigits is effectively the inverse of IntegerDigits and IntegerString." is literally the first line in Details section. $\endgroup$ – Kuba Dec 18 '18 at 12:03

The command IntegerDigits do the job


{5, 1, 2, 8}

However I really wonder how you could do that without defined function. Any idea?

| improve this answer | |

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