A037559 Decimal expansion of a(n) is given by the first n terms of the periodic sequence with initial period 2,1,1.
2, 21, 211, 2112, 21121, 211211, 2112112, 21121121, 211211211, 2112112112, 21121121121, 211211211211, 2112112112112, 21121121121121, 211211211211211, 2112112112112112
Offset: 1
Links
- G. C. Greubel, Table of n, a(n) for n = 1..990
- Index entries for linear recurrences with constant coefficients, signature (10,0,1,-10).
Crossrefs
Cf. A049347.
Programs
-
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
-
Mathematica
Table[FromDigits[PadRight[{},n,{2,1,1}]],{n,20}] (* Harvey P. Dale, Jul 15 2019 *)
-
PARI
Vec(x*(2+x+x^2) / ((x-1)*(10*x-1)*(1+x+x^2)) + O(x^25)) \\ Jinyuan Wang, Apr 14 2020
-
SageMath
def A037559(n): return (633*10^n -444 -27*(7*chebyshev_U(n, -1/2) + 3*chebyshev_U(n-1, -1/2)))/2997 [A037559(n) for n in range(1,40)] # G. C. Greubel, Oct 18 2022
Formula
G.f.: x*(2+x+x^2) / ((1-x)*(1-10*x)*(1+x+x^2)). - R. J. Mathar, Nov 21 2011