|
|
A291290
|
|
a(n) = n/3 if n == 0 mod 3, floor((n+1)/2) if n == 1 mod 3, otherwise n-2.
|
|
2
|
|
|
0, 1, 0, 1, 2, 3, 2, 4, 6, 3, 5, 9, 4, 7, 12, 5, 8, 15, 6, 10, 18, 7, 11, 21, 8, 13, 24, 9, 14, 27, 10, 16, 30, 11, 17, 33, 12, 19, 36, 13, 20, 39, 14, 22, 42, 15, 23, 45, 16, 25, 48, 17, 26, 51, 18, 28, 54, 19, 29, 57, 20, 31, 60, 21, 32, 63, 22, 34, 66, 23, 35, 69, 24, 37, 72, 25, 38, 75, 26, 40, 78
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
LINKS
|
|
|
FORMULA
|
G.f.: x*(1 + x^2 + x^3 + 3*x^4 + x^5 + x^6 + 3*x^7) / ((1 - x)^2*(1 + x)*(1 - x + x^2)*(1 + x + x^2)^2).
a(n) = a(n-3) + a(n-6) - a(n-9) for n>8. (End)
|
|
MAPLE
|
f:=proc(n)
if n mod 3 = 0 then n/3
elif n mod 3 = 1 then floor((n+1)/2)
else n-2 fi; end;
[seq(f(n), n=0..100)];
|
|
MATHEMATICA
|
a[n_] := Switch[Mod[n, 3], 0, n/3, 1, Floor[(n + 1)/2], _, n - 2];
|
|
PROG
|
(Magma) a:=func<n | n mod 3 eq 0 select n/3 else n mod 3 eq 1 select Floor((n+1)/2) else n-2>; [a(n): n in [0..100]]; // Bruno Berselli, Aug 30 2017
(PARI) a(n) = if(n%3==0, n\3, if(n%3==1, floor((n+1)/2), n-2)). - Colin Barker, Aug 30 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|