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)?


closed as off-topic by Kuba Dec 18 '18 at 12:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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?


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