OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,-1,0,0,0,0,0,0,10,-20,10).
FORMULA
From Jon E. Schoenfield, Nov 30 2014: (Start)
For n > 1, a(n) = a(n-1) + (10^(floor(log_10(a(n-1))) + 1) - 1) / 9.
For n > 0, a(n) = ((n-1) mod 9 + 1) * (10^D - 1) / 9 + 1 - D, where D = floor((n-1)/9) + 1. (There are exactly D digits in a(n).) (End)
G.f.: -(10*x^10-10*x^9+1)*x/((10*x^9-1)*(x-1)^2). - Alois P. Heinz, Nov 30 2014
EXAMPLE
98 = 9*10 + 8 -> 10*10 + 9 = 109.
109 = 1*100 + 0*10 + 9*1 -> 2*100 + 1*10 + 10*1 = 220.
a(42) = 44440 + (10^(floor(log_10(44440))+1)-1) / 9 = 44440 + (10^(4+1)-1) / 9 = 44440 + 99999/9 = 44440 + 11111 = 55551.
MATHEMATICA
a[0]=0; a[n_]:=FromDigits[IntegerDigits[a[n-1]]+1]; Array[a, 50, 0] (* Stefano Spezia, Sep 19 2024 *)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Dhilan Lahoti, Nov 30 2014
STATUS
approved