%I #39 Oct 06 2023 08:33:57
%S 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 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 6,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,11,12,13,14
%N Number of zeros in the concatenation n(n-1)(n-2)(n-3)...321.
%C 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
%H Hieronymus Fischer, <a href="/A061217/b061217.txt">Table of n, a(n) for n = 1..10000</a>
%H Tanya Khovanova and Gregory Marton, <a href="https://arxiv.org/abs/2305.10357">Archive Labeling Sequences</a>, arXiv:2305.10357 [math.HO], 2023.
%F From _Hieronymus Fischer_, Jun 12 2012: (Start)
%F 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)).
%F 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)).
%F a(10^m-1) = m*10^(m-1) - (10^m-1)/9.
%F (This is the total number of zeros occurring in all the numbers 1..10^m-1 or numbers with <= m places excluding zero.)
%F 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)
%e a(30) = 3 since number of zeros in 302928272625242322212019181716151413121110987654321 is 3. (This example implies offset = 1.)
%t Table[Count[Flatten[IntegerDigits/@Table[x-n,{n,0,x-1}]],0],{x,110}] (* _Harvey P. Dale_, Aug 10 2011 *)
%o (Haskell)
%o a061217 n = a061217_list !! (n-1)
%o a061217_list = scanl1 (+) $ map a055641 [1..]
%o -- _Reinhard Zumkeller_, Oct 27 2013
%o (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
%Y Cf. A055640, A055641, A102669-A102685, A117804.
%K nonn,base
%O 1,20
%A _Amarnath Murthy_, Apr 22 2001
%E Corrected and extended by _Patrick De Geest_, Jun 05 2001
%E Offset changed to 1 by _Hieronymus Fischer_, Jun 12 2012
|