This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

IntegerDigits

IntegerDigits[n]
gives a list of the decimal digits in the integer n.
IntegerDigits
gives a list of the base b digits in the integer n.
IntegerDigits
pads the list on the left with zeros to give a list of length len.
  • IntegerDigits gives the most significant digit first, as in standard positional notation.
  • If len is less than the number of digits in n then the len least significant digits are returned.
Find digits in base 10:
Find digits in base 2:
Find digits in base 10:
In[1]:=
Click for copyable input
Out[1]=
 
Find digits in base 2:
In[1]:=
Click for copyable input
Out[1]=
Bases larger than 10 can be used:
IntegerDigits threads itself over elements of lists:
Find the digits of 7 in different bases:
By default, IntegerDigits includes no leading zeros:
Pad all digit lists to be length 3:
Find only the last 4 digits:
Leading digits of factorials:
ChampernowneNumber has a decimal expansion that is a concatenation of consecutive integers:
Compare to ChampernowneNumber:
Cantor set construction:
Find all combinations of 3 binary digits:
Pad digit lists to be the same length:
The sign is ignored:
Leading digits of factorials in base 100:
New in 2 | Last modified in 5