login
A163495
a(0)=0, a(1)=1, a(2)=2. For n >= 3, a(n) = a(n-1) - min(a(n-2), a(n-3)).
1
0, 1, 2, 2, 1, -1, -2, -1, 1, 3, 4, 3, 0, -3, -3, 0, 3, 6, 6, 3, -3, -6, -3, 3, 9, 12, 9, 0, -9, -9, 0, 9, 18, 18, 9, -9, -18, -9, 9, 27, 36, 27, 0, -27, -27, 0, 27, 54, 54, 27, -27, -54, -27, 27, 81, 108, 81, 0, -81, -81, 0, 81, 162, 162, 81, -81, -162, -81, 81, 243, 324, 243, 0
OFFSET
0,3
COMMENTS
a(n+15) = 3*a(n) for all n. - Dion Gijswijt (gijswijt(AT)science.uva.nl) Jul 29 2009 on SeqFan mailing list.
LINKS
Index entries for linear recurrences with constant coefficients, signature (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3).
FORMULA
G.f. x*(1 +2*x +2*x^2 +x^3 -x^4 -2*x^5 -x^6 +x^7 +3*x^8 +4*x^9 +3*x^10 -3*x^12 -3*x^13) / (1 - 3*x^15 ). - R. J. Mathar, Jun 22 2011
MAPLE
a[0] := 0: a[1] := 1: a[2] := 2: for n from 3 to 80 do a[n] := a[n-1]-min(a[n-2], a[n-3]) end do: seq(a[n], n = 0 .. 80); # Emeric Deutsch, Aug 01 2009
MATHEMATICA
CoefficientList[Series[x*(1 +2*x +2*x^2 +x^3 -x^4 -2*x^5 -x^6 +x^7 +3*x^8 +4*x^9 +3*x^10 -3*x^12 -3*x^13)/(1 - 3*x^15 ), {x, 0, 50}], x] (* G. C. Greubel, Jul 26 2017 *)
nxt[{a_, b_, c_}]:={b, c, c-Min[a, b]}; NestList[nxt, {0, 1, 2}, 80][[All, 1]] (* or *) LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3}, {0, 1, 2, 2, 1, -1, -2, -1, 1, 3, 4, 3, 0, -3, -3}, 80] (* Harvey P. Dale, Apr 07 2018 *)
PROG
(PARI) x='x+O('x^50); concat([0], Vec(x*(1 +2*x +2*x^2 +x^3 -x^4 -2*x^5 -x^6 +x^7 +3*x^8 +4*x^9 +3*x^10 -3*x^12 -3*x^13)/(1 - 3*x^15 ))) \\ G. C. Greubel, Jul 26 2017
CROSSREFS
Sequence in context: A206829 A319694 A335641 * A060709 A035222 A136436
KEYWORD
sign
AUTHOR
Leroy Quet, Jul 29 2009
EXTENSIONS
Extended by Emeric Deutsch, Aug 01 2009
STATUS
approved