OFFSET
0,3
COMMENTS
Multiplicative with a(3^e) = 0, a(p^e) = p^e otherwise. - Mitch Harris, Jun 09 2005
Completely multiplicative with a(3) = 0, a(p) = p otherwise. - Charles R Greathouse IV, Feb 21 2011
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
FORMULA
a(n) = Product_{k=0..2} Sum_{j=1..n} w(3)^(k*j), w(3)=e^(2*Pi*i/3), i=sqrt(-1).
a(n) = 2*n/3 - n*sin(2*Pi*n/3 + Pi/3)/sqrt(3) - n*cos(2*Pi*n/3 + Pi/3)/3.
G.f.: x*(x^4 + 2*x^3 + 2*x + 1)/((x^2 + x + 1)^2*(x - 1)^2). - Ralf Stephan, Jan 29 2004
a(n) = n^3 mod 3n. - Paul Barry, Apr 13 2005
Dirichlet g.f.: zeta(s-1)*(1-1/3^(s-1)). - R. J. Mathar, Feb 10 2011
a(3*n) = 0, a(3*n + 1) = 3*n + 1, a(3*n + 2) = 3*n + 2. a(-n) = -a(n). - Michael Somos, Mar 19 2011
a(n) = n * sign(n mod 3). - Wesley Ivan Hurt, Sep 24 2017
EXAMPLE
x + 2*x^2 + 4*x^4 + 5*x^5 + 7*x^7 + 8*x^8 + 10*x^10 + 11*x^11 + 13*x^13 + ...
MATHEMATICA
f[n_] := If[ Mod[n, 3] == 0, 0, n] (* Or *) n (Fibonacci[n] - 2 Floor[ Fibonacci[n]/2]); Array[f, 78, 0] (* Robert G. Wilson v *)
{#, 0, #}[[Mod[#-1, 3, 1]]]&/@Range[0, 99] (* Federico Provvedi, Jun 15 2021 *)
PROG
(PARI) a(n)=if(n%3, n) \\ Charles R Greathouse IV, Feb 21 2011
(PARI) {a(n) = n * sign( n%3)} /* Michael Somos, Mar 19 2011 */
(Magma) &cat[[0, 3*n+1, 3*n+2]: n in [0..26]]; // Bruno Berselli, Aug 29 2011
CROSSREFS
KEYWORD
nonn,mult,easy
AUTHOR
Paul Barry, Jan 28 2004
STATUS
approved