login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A104204 If n==0 (mod 3) then a(n)=a(n-1); if n==1 (mod 3) then a(n)=a(n-2)+a(n-3); if n==2 (mod 3) then a(n)=a(n-3)+a(n-4)+a(n-5). 1
1, 1, 2, 3, 5, 4, 4, 9, 12, 12, 21, 25, 25, 46, 58, 58, 104, 129, 129, 233, 291, 291, 524, 653, 653, 1177, 1468, 1468, 2645, 3298, 3298, 5943, 7411, 7411, 13354, 16652, 16652, 30006, 37417, 37417, 67423, 84075, 84075, 151498, 188915, 188915, 340413, 424488 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
A sequentially switched sequence modulo 3.
LINKS
FORMULA
From Colin Barker, Nov 18 2015: (Start)
a(n) = 2*a(n-3)+a(n-6)-a(n-9) for n>11.
G.f.: -(x^11+x^10-2*x^9-2*x^8+2*x^7+3*x^6-3*x^4-x^3-2*x^2-x-1) / (x^9-x^6-2*x^3+1).
(End)
MAPLE
a:= proc(n) option remember; add(a(n-i), i=1+(n mod 3)..1+2*(n mod 3)) end proc:
a(0):= 1: a(1):= 1: a(2):= 2: a(3):= 3: a(4):= 5:
seq(a(n), n=0..100); # Robert Israel, Nov 18 2015
MATHEMATICA
a[n_Integer?Positive] := If[Mod[n, 3] == 0, a[n] = a[n - 1], If[Mod[n, 3] == 1, a[n] = a[n - 2] + a[n - 3], a[n] = a[n - 3] + a[n - 4] + a[n - 5]]] a[0] = 1; a[1] = 1; a[2] = 2; a[3] = 3; a[4] = 5; aa = Table[a[n], {n, 0, 200}]
PROG
(PARI) Vec(-(x^11+x^10-2*x^9-2*x^8+2*x^7+3*x^6-3*x^4-x^3-2*x^2-x-1)/(x^9-x^6-2*x^3+1) + O(x^60)) \\ Colin Barker, Nov 18 2015
CROSSREFS
Sequence in context: A023818 A102149 A321782 * A131296 A371216 A267808
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula, Mar 13 2005
EXTENSIONS
Typos in title and formula fixed by Colin Barker, Nov 18 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 29 00:51 EDT 2024. Contains 373826 sequences. (Running on oeis4.)