A307677 a(0) = a(1) = a(2) = a(3) = 1; thereafter a(n) = a(n-1) + a(n-2) + a(n-4).
1, 1, 1, 1, 3, 5, 9, 15, 27, 47, 83, 145, 255, 447, 785, 1377, 2417, 4241, 7443, 13061, 22921, 40223, 70587, 123871, 217379, 381473, 669439, 1174783, 2061601, 3617857, 6348897, 11141537, 19552035, 34311429, 60212361, 105665327, 185429723, 325406479, 571048563, 1002120369
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,1,0,1).
Programs
-
Magma
[n le 4 select 1 else Self(n-1) +Self(n-2) +Self(n-4): n in [1..51]]; // G. C. Greubel, Oct 23 2024
-
Mathematica
LinearRecurrence[{1,1,0,1}, {1,1,1,1}, 51] (* G. C. Greubel, Oct 23 2024 *)
-
PARI
Vec((1 - x^2 - x^3) / ((1 + x)*(1 - 2*x + x^2 - x^3)) + O(x^40)) \\ Colin Barker, Apr 25 2020
-
SageMath
@CachedFunction # a = A307677 def a(n): return 1 if n<4 else a(n-1) +a(n-2) +a(n-3) [a(n) for n in range(51)] # G. C. Greubel, Oct 23 2024
Formula
From Colin Barker, Apr 25 2020: (Start)
G.f.: (1 - x^2 - x^3) / ((1 + x)*(1 - 2*x + x^2 - x^3)).
a(n) = a(n-1) + a(n-2) + a(n-4) for n>3. (End)
a(n) = (1/5)*((-1)^n + 2*(2*A005314(n+1) - A005314(n) - 2*A005314(n-1))). - G. C. Greubel, Oct 23 2024
Comments