OFFSET
0,3
COMMENTS
The total number of nonzero digits occurring in all the numbers 0, 1, 2, ... n (in decimal representation). - Hieronymus Fischer, Jun 10 2012
LINKS
Hieronymus Fischer, Table of n, a(n) for n = 0..10000
FORMULA
From Hieronymus Fischer, Jun 06 2012: (Start)
a(n) = (1/2)*Sum_{j=1..m+1} (floor((n/10^j)+0.9)*(2n + 2 + (0.8 - floor((n/10^j)+0.9))*10^j) - floor(n/10^j)*(2n + 2 - (floor(n/10^j)+1) * 10^j)), where m = floor(log_10(n)).
a(n) = (n+1)*A055640(n) + (1/2)*Sum_{j=1..m+1} ((8*floor((n/10^j)+0.9)/10 + floor(n/10^j))*10^j - (floor((n/10^j)+0.9)^2 - floor(n/10^j)^2)*10^j), where m = floor(log_10(n)).
a(10^m-1) = 9*m*10^(m-1). (This is the total number of nonzero digits occurring in all the numbers with <= m digits.)
G.f.: g(x) = (1/(1-x)^2) * Sum_{j>=0} (x^10^j - x^(10*10^j))/(1-x^10^(j+1)). (End)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 03 2005
STATUS
approved