Mathematica 9 is now available

DigitCount

Usage

DigitCount[n, b, d]用来给出nb进制表示中数字d的个数.
DigitCount[n, b]用来给出nb进制表示中数字1,2,...,b-1, 0的个数.
DigitCount[n]用来给出n10进制表示中数字1,2,...,9, 0的个数.


Notes

DigitCount[n]等价于 DigitCount[n, 10, Mod[Range[10],10]].
• 整型数学函数(参见 A.3.10节).
• 参见Mathematica全书: 3.2.4节.
Further Examples

Here is a small number.

In[1]:=  

Here are two ways to see its digits in base  .

In[2]:=  

Out[2]//BaseForm=

In[3]:=  

Out[3]=

This counts how many times  occurs in the base  expansion of x.

In[4]:=  

Out[4]=

In the list of digits there are  ones,  two,  threes,  fours,  fives,  sixes and  zeros.

In[5]:=  

Out[5]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.