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”).

A356849
a(n) = a(n-1) - a(n-2) + 3*a(n-3) with a(0) = 1, a(1) = 2 and a(2) = 4.
1
1, 2, 4, 5, 7, 14, 22, 29, 49, 86, 124, 185, 319, 506, 742, 1193, 1969, 3002, 4612, 7517, 11911, 18230, 28870, 46373, 72193, 112430, 179356, 283505, 441439, 696002, 1105078, 1733393, 2716321, 4298162, 6782020, 10632821, 16745287, 26458526, 41611702, 65389037
OFFSET
0,2
COMMENTS
This sequence is mentioned in the Mathologer video in the links section.
FORMULA
a(n) = a(n-1) - a(n-2) + 3*a(n-3) with a(0) = 1, a(1) = 2 and a(2) = 4.
From G. C. Greubel, Aug 31 2022: (Start)
a(n) = A*(r1)^n + B*(r2)^n + C*(r3)^n, where r1 = (1 + x - y)/3, r2 = (2 - (1 + i*sqrt(3))*x +(1-i*sqrt(3))*y)/6, r3 = (2 -(1-i*sqrt(3))*x +(1-i*sqrt(3))*y)/6, x = (9*sqrt(17) + 37)^(1/3), y = (9*sqrt(17) - 37)^(1/3), A = (2-r2)*(2-r3)/((r1-r2)*(r1-r3)), B = (2-r1)*(2-r3)/((r2-r1)*(r2-r3)), C = (2-r1)*(2-r2)/((r3-r1)*(r3-r2)).
G.f.: (1 + x + 3*x^2)/(1 - x + x^2 - 3*x^3). (End)
EXAMPLE
a(4) = 7 because a(3) - a(2) + 3*a(1) = 5 - 4 + 2*3 = 7.
Number wall:
.. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
.. 1 2 4 5 7 14 22 29 49 86 142 185 319 506 ...
.. -1 0 6 -3 -21 42 78 -237 -93 1320 -534 -11073 8151 .......
.. 1 3 9 27 81 243 729 2187 6561 19693 ........................
.. 0 0 0 0 0 0 0 0 0 ..............................
MATHEMATICA
a[1]=1; a[2]=2; a[3]=4; a[n_]:=a[n]=a[n-1]-a[n-2]+3a[n-3]; Array[a, 50]
(* second program *)
LinearRecurrence[{1, -1, 3}, {1, 2, 4}, 40]
PROG
(Magma) [n le 3 select 2^(n-1) else Self(n-1) -Self(n-2) +3*Self(n-3): n in [1..41]]; // G. C. Greubel, Aug 31 2022
(SageMath)
@CachedFunction
def a(n): return 2^n if (n<3) else a(n-1) - a(n-2) + 3*a(n-3) # a = A356849
[a(n) for n in (0..40)] # G. C. Greubel, Aug 31 2022
CROSSREFS
Sequence in context: A332296 A115883 A063508 * A101724 A123210 A019277
KEYWORD
nonn,easy
AUTHOR
STATUS
approved