OFFSET
1,2
COMMENTS
Periodic sequences of this type can be easily calculated by a(n) = floor(q*10^n/(10^m-1)), where q is the number representing the periodic digit pattern (=123 for this sequence) and m is the period length. - Hieronymus Fischer Jan 03 2013
LINKS
Hieronymus Fischer, Table of n, a(n) for n = 1..200
Index entries for linear recurrences with constant coefficients, signature (10,0,1,-10).
FORMULA
a(n) = floor((41/333)*10^n). - Hieronymus Fischer, Jan 03 2013
From Colin Barker, Apr 30 2014: (Start)
a(n) = 10*a(n-1) + a(n-3) - 10*a(n-4).
G.f.: x*(3*x^2 + 2*x + 1) / ((x - 1)*(10*x - 1)*(x^2 + x + 1)). (End)
a(n) = (41*10^n - 27*n - 50 + 90*floor(n/3) - 9*floor((n - 1)/3))/333. - Bruno Berselli, Sep 13 2018
MAPLE
MATHEMATICA
a[n_] := Floor[41/333*10^n]; Array[a, 19] (* Robert G. Wilson v, Apr 18 2014 *)
Table[FromDigits[PadRight[{}, n, {1, 2, 3}]], {n, 20}] (* or *) LinearRecurrence[ {10, 0, 1, -10}, {1, 12, 123, 1231}, 20] (* Harvey P. Dale, May 09 2014 *)
PROG
(PARI) A037610(n)=10^n*41\333 \\ M. F. Hasler, Jan 13 2013
(PARI) Vec(x*(3*x^2+2*x+1)/((x-1)*(10*x-1)*(x^2+x+1)) + O(x^100)) \\ Colin Barker, Apr 30 2014
(Magma) [(41*10^n-27*n-50+90*Floor(n/3)-9*Floor((n-1)/3))/333: n in [1..30]]; // Bruno Berselli, Sep 13 2018
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved