This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / New in Version 3.0 / Numerical Computation  /
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: Section 3.1.3.
  • See also: RealDigits, BaseForm, NumberForm, FromDigits, IntegerPart.
  • Related package: NumberTheory`ContinuedFractions`.

    Further Examples

    Here is a list of the decimal digits in the number 10! and in base 2.

    In[1]:=

    Out[1]=

    In[2]:=

    Out[2]=