WOLFRAM

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.

Details

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

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Find the number of decimal digits in 123456789:

Out[1]=1

The number of binary digits in :

Out[1]=1

Plot it:

Out[1]=1
Out[2]=2

The IntegerLength for different bases:

Out[1]=1

Applications  (2)Sample problems that can be solved with this function

Out[1]=1

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

Out[1]=1
Wolfram Research (2007), IntegerLength, Wolfram Language function, https://reference.wolfram.com/language/ref/IntegerLength.html.
Wolfram Research (2007), IntegerLength, Wolfram Language function, https://reference.wolfram.com/language/ref/IntegerLength.html.

Text

Wolfram Research (2007), IntegerLength, Wolfram Language function, https://reference.wolfram.com/language/ref/IntegerLength.html.

Wolfram Research (2007), IntegerLength, Wolfram Language function, https://reference.wolfram.com/language/ref/IntegerLength.html.

CMS

Wolfram Language. 2007. "IntegerLength." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IntegerLength.html.

Wolfram Language. 2007. "IntegerLength." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/IntegerLength.html.

APA

Wolfram Language. (2007). IntegerLength. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IntegerLength.html

Wolfram Language. (2007). IntegerLength. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/IntegerLength.html

BibTeX

@misc{reference.wolfram_2025_integerlength, author="Wolfram Research", title="{IntegerLength}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/IntegerLength.html}", note=[Accessed: 29-March-2025 ]}

@misc{reference.wolfram_2025_integerlength, author="Wolfram Research", title="{IntegerLength}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/IntegerLength.html}", note=[Accessed: 29-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_integerlength, organization={Wolfram Research}, title={IntegerLength}, year={2007}, url={https://reference.wolfram.com/language/ref/IntegerLength.html}, note=[Accessed: 29-March-2025 ]}

@online{reference.wolfram_2025_integerlength, organization={Wolfram Research}, title={IntegerLength}, year={2007}, url={https://reference.wolfram.com/language/ref/IntegerLength.html}, note=[Accessed: 29-March-2025 ]}