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 A054899 #48 Feb 16 2025 08:32:42 %S A054899 0,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, %T A054899 3,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, %U A054899 6,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,11,11 %N A054899 a(n) = Sum_{k>0} floor(n/10^k). %C A054899 The old definition of this sequence was "Highest power of 10 dividing n!", but that is wrong (see A027868). For example, the highest power of 10 dividing 5!=120 is 1; however, a(5)=0. - _Hieronymus Fischer_, Jun 18 2007 %C A054899 Highest power of 10 dividing the quotient of multifactorials Product_{k>=1} M(10^k, 10^k*floor(n/10^k)) /( Product_{k>=1} M(10^(k-1), 10^(k-1) * floor(n/10^k)) ) where M(r,s) is the r-multifactorial (r>=1) of s which is defined by M(r,s) = s*M(r,s-r) for s > 0, M(r,s) = 1 for s <= 0. This is because that quotient of multifactorials evaluates to the product 10^floor(n/10)*10^floor(n/100)*... - _Hieronymus Fischer_, Jun 14 2007 %C A054899 Partial sums of A122840. - _Hieronymus Fischer_, Jun 06 2012 %C A054899 Called the "terminating nines function" by Kennedy et al. (1989). a(n) is the number of terminating nines which occur up to n but not including n. - _Amiram Eldar_, Sep 06 2024 %H A054899 Hieronymus Fischer, <a href="/A054899/b054899.txt">Table of n, a(n) for n = 0..10000</a> %H A054899 Robert K. Kennedy, Curtis N. Cooper, Vladimir Drobot, and Fred Hickling, <a href="https://doi.org/10.1155/S0161171289000992">On the natural density of the range of the terminating nines function</a>, International Journal of Mathematics and Mathematical Sciences, Vol. 12, No. 4 (1989), pp. 805-808. %H A054899 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Multifactorial.html">Multifactorial</a>. %F A054899 a(n) = floor(n/10) + floor(n/100) + floor(n/1000) + ... %F A054899 a(n) = (n - A007953(n))/9. %F A054899 From _Hieronymus Fischer_, Jun 14 2007, Jun 25 2007, and Aug 13 2007: (Start) %F A054899 a(n) = Sum_{k>0} floor(n/10^k). %F A054899 a(n) = Sum_{k=10..n} Sum_{j|k, j>=10} ( floor(log_10(j)) -floor(log_10(j-1)) ). %F A054899 G.f.: g(x) = ( Sum_{k>0} x^(10^k)/(1-x^(10^k)) )/(1-x). %F A054899 G.f. expressed in terms of Lambert series: %F A054899 g(x) = L[b(k)](x)/(1-x) where L[b(k)](x) = Sum_{k>=0} b(k)*x^k/(1-x^k) is a Lambert series with b(k)=1, if k>1 is a power of 10, else b(k)=0. %F A054899 G.f.: g(x) = ( Sum_{k>0} c(k)*x^k )/(1-x), where c(k) = Sum_{j>1, j|k} (floor(log_10(j)) - floor(log_10(j-1)) ). %F A054899 a(n) = Sum_{k=0..floor(log_10(n))} ds_10(floor(n/10^k))*10^k - n where ds_10(x) = digital sum of x in base 10. %F A054899 a(n) = Sum_{k=0..floor(log_10(n))} A007953(floor(n/10^k))*10^k - n. %F A054899 Recurrence: %F A054899 a(n) = floor(n/10) + a(floor(n/10)). %F A054899 a(10*n) = n + a(n). %F A054899 a(n*10^m) = n*(10^m-1)/9 + a(n). %F A054899 a(k*10^m) = k*(10^m-1)/9, for 0 <= k < 10, m >= 0. %F A054899 Asymptotic behavior: %F A054899 a(n) = n/9 + O(log(n)), %F A054899 a(n+1) - a(n) = O(log(n)), which follows from the inequalities below. %F A054899 a(n) <= (n - 1)/9; equality holds for powers of 10. %F A054899 a(n) >= n/9 - 1 - floor(log_10(n)); equality holds for n=10^m-1, m>0. %F A054899 lim inf (n/9 - a(n)) = 1/9, for n --> oo. %F A054899 lim sup (n/9 - log_10(n) - a(n)) = 0, for n --> oo. %F A054899 lim sup (a(n+1) - a(n) - log_10(n)) = 0, for n --> oo. (End) %e A054899 a(11) = 1 %e A054899 a(111) = 12. %e A054899 a(1111) = 123. %e A054899 a(11111) = 1234. %e A054899 a(111111) = 12345. %e A054899 a(1111111) = 123456. %e A054899 a(11111111) = 1234567. %e A054899 a(111111111) = 12345678. %e A054899 a(1111111111) = 123456789. %t A054899 Table[t=0; p=10; While[s=Floor[n/p]; t=t+s; s>0, p*=10]; t, {n,0,100}] %o A054899 (PARI) a(n)=my(s);while(n\=10,s+=n);s \\ _Charles R Greathouse IV_, Jul 19 2011 %o A054899 (Magma) %o A054899 m:=10; %o A054899 function a(n) // a = A054899, m = 10 %o A054899 if n eq 0 then return 0; %o A054899 else return a(Floor(n/m)) + Floor(n/m); %o A054899 end if; end function; %o A054899 [a(n): n in [0..103]]; // _G. C. Greubel_, Apr 28 2023 %o A054899 (SageMath) %o A054899 m=10 # a = A054899 %o A054899 def a(n): return 0 if (n==0) else a(n//m) + (n//m) %o A054899 [a(n) for n in range(104)] # _G. C. Greubel_, Apr 28 2023 %Y A054899 Cf. A011371 and A054861 for analogs involving powers of 2 and 3. %Y A054899 Different from the highest power of 10 dividing n! (see A027868 for reference). %Y A054899 Cf. A007953, A027868, A067080, A098844, A132027, A122840. %K A054899 nonn %O A054899 0,21 %A A054899 _Henry Bottomley_, May 23 2000 %E A054899 An incorrect g.f. was deleted by _N. J. A. Sloane_, Sep 13 2009 %E A054899 Examples added by _Hieronymus Fischer_, Jun 06 2012