OFFSET
0,3
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Michael Somos, Rational function multiplicative coefficients.
Index entries for linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
FORMULA
Euler transform of length 4 sequence [ 2, -1, 2, -1].
a(n) is multiplicative with a(3^e) = (2*3^e + 0^e)/3, a(p^e) = p^e otherwise.
G.f.: x * (1 + x)^2 * (1 + x^2) / (1 - x^3)^2.
a(-n) = -a(n).
Dirichlet g.f.: zeta(s-1)*(1-1/3^s). - R. J. Mathar, Mar 12 2012
a(0)=0, a(1)=1, a(2)=2, a(3)=2, a(4)=4, a(5)=5, a(n)=2*a(n-3)-a(n-6). - Harvey P. Dale, Apr 15 2015
a(n) = n*(8 - 2*cos((2*Pi*n)/3)) / 9. - Colin Barker, Mar 06 2017
Sum_{k=1..n} a(k) ~ (4/9) * n^2. - Amiram Eldar, Nov 28 2022
EXAMPLE
x + 2*x^2 + 2*x^3 + 4*x^4 + 5*x^5 + 4*x^6 + 7*x^7 + 8*x^8 + 6*x^9 + ...
MATHEMATICA
Table[If[Divisible[n, 3], 2 n/3, n], {n, 0, 80}] (* or *) LinearRecurrence[ {0, 0, 2, 0, 0, -1}, {0, 1, 2, 2, 4, 5}, 80] (* Harvey P. Dale, Apr 15 2015 *)
PROG
(PARI) {a(n) = n - if( n%3, 0, n/3)}
(PARI) {a(n) = if( n==0, 0, sign(n) * direuler( p=2, abs(n), (1 - (p==3) * X) / (1 - p * X)) [abs(n)])}
(PARI) concat(0, Vec(x*(1 + x)^2*(1 + x^2)/(1 - x^3)^2 + O(x^100))) \\ Colin Barker, Mar 06 2017
CROSSREFS
KEYWORD
nonn,mult,easy
AUTHOR
Michael Somos, Feb 12 2011
STATUS
approved