A160094 a(n) = 1 + A122840(n).
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1
Offset: 1
Examples
a(160) = 2 because the last nonzero digit of 160 (counting from left to right), when 160 is written in base 10, is 6, and that 6 occurs 2 digits from the right in 160.
Links
- Rick L. Shepherd, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
IntegerExponent[Range[150]]+1 (* Harvey P. Dale, Feb 06 2015 *)
Formula
From Hieronymus Fischer, Jun 08 2012: (Start)
With m = floor(log_10(n)), frac(x) = x-floor(x):
a(n) = Sum_{j=0..m} (1 - ceiling(frac(n/10^j))).
a(n) = m + 1 + Sum_{j=1..m} (floor(-frac(n/10^j))).
G.f.: g(x) = (x/(1-x)) + Sum_{j>0} x^10^j/(1-x^10^j). (End)
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 10/9. - Amiram Eldar, Jul 10 2023
a(n) = A122840(10*n). - R. J. Mathar, Jun 28 2025
Extensions
Name simplified by Jon E. Schoenfield, Feb 26 2014
Comments