IntegerDigits
IntegerDigits[n] gives a list of the decimal digits in the integer n.
IntegerDigits[n, b] gives a list of the base-b digits in the integer n.
IntegerDigits[n, b, len] pads the list on the left with zeros to give a list of length len.
Examples: IntegerDigits[5810]
; IntegerDigits[5810, 16]
.
IntegerDigits[n] discards the sign of n.
If len is less than the number of digits in n then the len least significant digits are returned.
FromDigits can be used as the inverse of IntegerDigits.
See The Mathematica Book on the web: Section 3.1.3.
Implementation Notes: see Section A.9.4.
See also: DigitCount, RealDigits, BaseForm, FromDigits, IntegerExponent, IntegerPart, ContinuedFraction.
Further Examples