login
A186101
a(n) = 2*n / 3 if n divisible by 3, a(n) = n otherwise.
2
0, 1, 2, 2, 4, 5, 4, 7, 8, 6, 10, 11, 8, 13, 14, 10, 16, 17, 12, 19, 20, 14, 22, 23, 16, 25, 26, 18, 28, 29, 20, 31, 32, 22, 34, 35, 24, 37, 38, 26, 40, 41, 28, 43, 44, 30, 46, 47, 32, 49, 50, 34, 52, 53, 36, 55, 56, 38, 58, 59, 40, 61, 62, 42, 64, 65, 44, 67, 68, 46, 70, 71, 48
OFFSET
0,3
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
Sequence in context: A138557 A129303 A255368 * A284722 A202876 A128900
KEYWORD
nonn,mult,easy
AUTHOR
Michael Somos, Feb 12 2011
STATUS
approved