login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A037610
Decimal expansion of a(n) is given by the first n terms of the periodic sequence with initial period 1,2,3.
9
1, 12, 123, 1231, 12312, 123123, 1231231, 12312312, 123123123, 1231231231, 12312312312, 123123123123, 1231231231231, 12312312312312, 123123123123123, 1231231231231231, 12312312312312312, 123123123123123123, 1231231231231231231, 12312312312312312312
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
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
A037610:=n->floor((41/333)*10^n); seq(A037610(n), n=1..20); # Wesley Ivan Hurt, Apr 19 2014
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
Sequence in context: A144165 A113572 A037701 * A035239 A344183 A057137
KEYWORD
nonn,base,easy
STATUS
approved