OFFSET
0,3
COMMENTS
The arithmetic function v_3(n,3) as defined in A289187. - Robert Price, Aug 22 2017
LINKS
Harry J. Smith, Table of n, a(n) for n=0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
O.g.f.: (1-x+3*x^2)/((-1+x)^2*(1+x+x^2)). - R. J. Mathar, Apr 02 2008
a(n) = (3*n + 1 - 4*cos(2*(n+2)*Pi/3))/3. - Wesley Ivan Hurt, Sep 26 2017
a(n) = a(n-1) + a(n-3) - a(n-4) for n > 3. - Wesley Ivan Hurt, Oct 07 2017
EXAMPLE
a(4) = 4 + (-1)^1 = 3.
MAPLE
MATHEMATICA
Table[n + (-1)^Mod[n, 3], {n, 0, 80}] (* Vincenzo Librandi, Aug 23 2017 *)
PROG
(PARI) { for (n=0, 1000, write("b061800.txt", n, " ", n + (-1)^(n%3)) ) } \\ Harry J. Smith, Jul 28 2009
(Magma) [n+(-1)^(n mod 3): n in [0..80]]; // Vincenzo Librandi, Aug 23 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Olivier Gérard, Jun 22 2001
STATUS
approved