Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #31 Dec 14 2023 05:34:24
%S 2,21,211,2112,21121,211211,2112112,21121121,211211211,2112112112,
%T 21121121121,211211211211,2112112112112,21121121121121,
%U 211211211211211,2112112112112112
%N Decimal expansion of a(n) is given by the first n terms of the periodic sequence with initial period 2,1,1.
%H G. C. Greubel, <a href="/A037559/b037559.txt">Table of n, a(n) for n = 1..990</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (10,0,1,-10).
%F G.f.: x*(2+x+x^2) / ((1-x)*(1-10*x)*(1+x+x^2)). - _R. J. Mathar_, Nov 21 2011
%F a(n) = (633*10^n - 444 - 27*( 7*A049347(n) + 3*A049347(n-1) ))/2997. - _G. C. Greubel_, Oct 18 2022
%t Table[FromDigits[PadRight[{},n,{2,1,1}]],{n,20}] (* _Harvey P. Dale_, Jul 15 2019 *)
%o (PARI) Vec(x*(2+x+x^2) / ((x-1)*(10*x-1)*(1+x+x^2)) + O(x^25)) \\ _Jinyuan Wang_, Apr 14 2020
%o (Magma) I:=[2, 21, 211, 2112]; [n le 4 select I[n] else 10*Self(n-1) +Self(n-3) -10*Self(n-4): n in [1..40]]; // _G. C. Greubel_, Oct 18 2022
%o (SageMath)
%o def A037559(n): return (633*10^n -444 -27*(7*chebyshev_U(n, -1/2) + 3*chebyshev_U(n-1, -1/2)))/2997
%o [A037559(n) for n in range(1,40)] # _G. C. Greubel_, Oct 18 2022
%Y Cf. A049347.
%K nonn,base,easy
%O 1,1
%A _Clark Kimberling_