This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A102684 #26 Oct 03 2023 13:16:28 %S A102684 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3, %T A102684 3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6, %U A102684 6,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,9,10,11,12,13,14,15,16,17,18,20 %N A102684 Number of times the digit 9 appears in the decimal representations of all integers from 0 to n. %C A102684 This is the total number of digits = 9 occurring in all the numbers 0, 1, 2, ... n (in decimal representation). - _Hieronymus Fischer_, Jun 10 2012 %H A102684 Hieronymus Fischer, <a href="/A102684/b102684.txt">Table of n, a(n) for n = 0..10000</a> %F A102684 From _Hieronymus Fischer_, Jun 10 2012: (Start) %F A102684 a(n) = (1/2)*Sum_{j=1..m+1} (floor(n/10^j + 1/10)*(2n + 2 - (4/5 + floor(n/10^j + 1/10))*10^j) - floor(n/10^j)*(2n + 2 - (1+floor(n/10^j)) * 10^j)), where m = floor(log_10(n)). %F A102684 a(n) = (n+1)*A102683(n) + (1/2)*Sum_{j=1..m+1} ((-4/5*floor(n/10^j + 1/10) + floor(n/10^j))*10^j - (floor(n/10^j + 1/10)^2 - floor(n/10^j)^2)*10^j), where m = floor(log_10(n)). %F A102684 a(10^m-1) = m*10^(m-1). %F A102684 (this is total number of digits = 9 occurring in all the numbers with <= m places). %F A102684 G.f.: g(x) = (1/(1-x)^2)*Sum_{j>=0} (x^(9*10^j) - x^(10*10^j))/(1-x^10^(j+1)). (End) %p A102684 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(add(p(i),i=0..n), n=0..105); # _Emeric Deutsch_, Feb 23 2005 %t A102684 Accumulate[DigitCount[Range[0,100],10,9]] (* _Harvey P. Dale_, Mar 30 2018 *) %o A102684 (PARI) a(n) = sum(k=0, n, #select(x->(x==9), digits(k))); \\ _Michel Marcus_, Oct 03 2023 %Y A102684 Partial sums of A102683. %Y A102684 Cf. A027868, A054899, A055640, A055641, A102669-A102685, A117804, A122840, A122841, A160093, A160094, A196563, A196564. %Y A102684 Cf. A000120, A000788, A023416, A059015 (for base 2). %K A102684 nonn,base,easy %O A102684 0,20 %A A102684 _N. J. A. Sloane_, Feb 03 2005 %E A102684 More terms from _Emeric Deutsch_, Feb 23 2005 %E A102684 Definition revised by _N. J. A. Sloane_, Mar 30 2018