A055641 Number of zero digits in n.
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1
Offset: 0
Examples
a(99) = 0 because the digits of 99 are 9 and 9, a(100) = 2 because the digits of 100 are 1, 0 and 0 and there are two 0's.
Links
- Hieronymus Fischer, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
Haskell
a055641 n | n < 10 = 0 ^ n | otherwise = a055641 n' + 0 ^ d where (n',d) = divMod n 10 -- Reinhard Zumkeller, Apr 30 2013
-
Mathematica
Array[Last@ DigitCount@ # &, 105] (* Michael De Vlieger, Jul 02 2015 *)
-
PARI
a(n)=if(n,n=digits(n); sum(i=2,#n,n[i]==0), 1) \\ Charles R Greathouse IV, Sep 13 2015
-
PARI
A055641(n)=#select(d->!d,digits(n))+!n \\ M. F. Hasler, Jun 22 2018
-
Python
def a(n): return str(n).count("0") print([a(n) for n in range(106)]) # Michael S. Branicky, May 26 2022
Formula
From Hieronymus Fischer, Jun 06 2012: (Start)
a(n) = m + 1 - A055640(n) = Sum_{j=1..m+1} (1 + floor(n/10^j) - floor(n/10^j+0.9)), where m = floor(log_10(n)).
G.f.: g(x) = 1 + (1/(1-x))*Sum_{j>=0} (x^(10*10^j) - x^(11*10^j))/(1-x^10^(j+1)). (End)
a(n) = if n<10 then A000007(n) else a(A059995(n)) + A000007(A010879(n)). - Reinhard Zumkeller, Apr 30 2013, corrected by M. F. Hasler, Jun 22 2018