OFFSET
1,20
COMMENTS
The number of zeros necessary to write down all the numbers 1, 2, ..., n. Thus, the partial sums of A055641 are given by a(n)+1 (for n>=1). - Hieronymus Fischer, Jun 12 2012
LINKS
Hieronymus Fischer, Table of n, a(n) for n = 1..10000
Tanya Khovanova and Gregory Marton, Archive Labeling Sequences, arXiv:2305.10357 [math.HO], 2023.
FORMULA
From Hieronymus Fischer, Jun 12 2012: (Start)
a(n) = (m+1)*(n+1) - (10^(m+1)-1)/9 + (1/2)*Sum_{j=1..m+1} (floor(n/10^j)*(2n + 2 - (1 + floor(n/10^j))*10^j) - floor(n/10^j + 9/10)*(2n + 2 + ((4/5 - floor(n/10^j + 9/10))*10^j)), where m=floor(log_10(n)).
a(n) = A117804(n+1) - (n+1)*A054640(n) + (1/2)*Sum_{j=1..m+1} ((floor(n/10^j + 9/10)^2 - floor(n/10^j)^2)*10^j - (4/5*floor(n/10^j + 9/10) + floor(n/10^j))*10^j), where m=floor(log_10(n)).
a(10^m-1) = m*10^(m-1) - (10^m-1)/9.
(This is the total number of zeros occurring in all the numbers 1..10^m-1 or numbers with <= m places excluding zero.)
G.f.: g(x) = (1/(1-x)^2)*Sum_{j>=0} (1-x^10^j)*x^10^(j+1)/(1-x^10^(j+1)). (End)
EXAMPLE
a(30) = 3 since number of zeros in 302928272625242322212019181716151413121110987654321 is 3. (This example implies offset = 1.)
MATHEMATICA
Table[Count[Flatten[IntegerDigits/@Table[x-n, {n, 0, x-1}]], 0], {x, 110}] (* Harvey P. Dale, Aug 10 2011 *)
PROG
(Haskell)
a061217 n = a061217_list !! (n-1)
a061217_list = scanl1 (+) $ map a055641 [1..]
-- Reinhard Zumkeller, Oct 27 2013
(PARI) a(n) = my(m=logint(n, 10)); (m+1)*(n+1) - (10^(m+1)-1)/9 + (1/2) * sum(j=1, m+1, (n\10^j * (2*n+2 - (1 + n\10^j) * 10 ^ j) - floor(n/10^j+9/10) * (2*n+2 + ((4/5 - floor(n / 10^j + 9 / 10))*10^j)))) \\ adapted from formula by Hieronymus Fischer \\ David A. Corneth, Jan 23 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, Apr 22 2001
EXTENSIONS
Corrected and extended by Patrick De Geest, Jun 05 2001
Offset changed to 1 by Hieronymus Fischer, Jun 12 2012
STATUS
approved