gives the number of digits in the base 10 representation of the integer n.


gives the number of digits in the base b representation of n.


  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • IntegerLength[n,b] is effectively an efficient version of Floor[Log[b,n]]+1.
  • IntegerLength ignores the sign of n.
  • IntegerLength automatically threads over lists.


open allclose all

Basic Examples  (4)

Find the number of decimal digits in 123456789:

The number of binary digits in :

Plot it:

The IntegerLength for different bases:

Applications  (2)

Find how the number of digits in decreases with the base:

Introduced in 2007