A100550 a(n) = a(n-1) + 2*a(n-2) + 3*a(n-3), for n>3, otherwise a(n) = n.
0, 1, 2, 4, 11, 25, 59, 142, 335, 796, 1892, 4489, 10661, 25315, 60104, 142717, 338870, 804616, 1910507, 4536349, 10771211, 25575430, 60726899, 144191392, 342371480, 812934961, 1930252097, 4583236459, 10882545536, 25839774745, 61354575194
Offset: 0
References
- Harold Abelson and Gerald Jay Sussman with Julie Sussman, Structure and Interpretation of Computer Programs, MIT Press, 1996.
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,2,3).
Programs
-
Magma
[n le 3 select n-1 else Self(n-1) +2*Self(n-2) +3*Self(n-3): n in [1..41]]; // G. C. Greubel, Mar 27 2023
-
Mathematica
LinearRecurrence[{1,2,3},{0,1,2},40] (* Harvey P. Dale, Mar 19 2023 *)
-
Perl
perl -e '@a=(0,1,2);for(3..30){$a[$]=$a[$-1]+2*$a[$-2]+3*$a[$-3];} print "@a ";'
-
SageMath
@CachedFunction def a(n): # a = A100550 if (n<3): return n else: return a(n-1) + 2*a(n-2) + 3*a(n-3) [a(n) for n in range(41)] # G. C. Greubel, Mar 27 2023
Formula
From R. J. Mathar, Aug 22 2008: (Start)
O.g.f.: x*(1+x)/(1-x-2*x^2-3*x^3).
Comments