login
Number of digits 9 in decimal representation of n.
22

%I #30 Jul 24 2023 02:36:53

%S 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,

%T 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,

%U 0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,0,0,0,0,0

%N Number of digits 9 in decimal representation of n.

%H Reinhard Zumkeller, <a href="/A102683/b102683.txt">Table of n, a(n) for n = 0..10000</a>

%F a(A007095(n)) = 0; a(A011539(n)) > 0. - _Reinhard Zumkeller_, Dec 29 2011

%F From _Hieronymus Fischer_, Jun 10 2012: (Start)

%F a(n) = Sum_{j=1..m+1} (floor(n/10^j + 1/10) - floor(n/10^j)), where m=floor(log_10(n)).

%F G.f.: g(x) = (1/(1-x))*Sum_{j>=0} (x^(9*10^j) - x^(10*10^j))/(1-x^10^(j+1)). (End)

%F a(A235049(n)) = 0. - _Reinhard Zumkeller_, Apr 16 2014

%p p:=proc(n) local b,ct,j: b:=convert(n,base,10): ct:=0: for j from 1 to nops(b) do if b[j]>=9 then ct:=ct+1 else ct:=ct fi od: ct: end: seq(p(n),n=0..116); # _Emeric Deutsch_, Feb 23 2005

%t a[n_] := DigitCount[n, 10, 9]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 24 2023 *)

%o (Haskell)

%o a102683 = length . filter (== '9') . show

%o -- _Reinhard Zumkeller_, Dec 29 2011

%Y Cf. A007095, A011539, A027868, A054899, A055640, A055641, A102669-A102685, A117804, A122840, A122841, A160093, A160094, A196563, A196564, A235049.

%Y Cf. A102684 (partial sums).

%Y Cf. A000120, A000788, A023416, A059015 (for base 2).

%K nonn,base,easy

%O 0,100

%A _N. J. A. Sloane_, Feb 03 2005

%E More terms from _Emeric Deutsch_, Feb 23 2005