OFFSET
1,2
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 1..10000
FORMULA
G.f.: x(1+x+2x^2-2x^3+x^4)/((1-x)^3(1+x+x^2)). [R. J. Mathar, Sep 06 2008]
EXAMPLE
a(3) = 7 = T(3) + 1 since 3 == 0 mod 3 and T(3) = 6.
a(4) = 10 = T(4) since 4 == 1 mod 3.
MAPLE
A143097 := proc(n) if(n<=1)then return n: elif(n mod 3 <= 1)then return n+1-2*(n mod 3): else return n: fi: end: A143101 := proc(n) option remember: if(n=0)then return 0:else return procname(n-1)+A143097(n):fi: end:seq(A143101(n), n=1..60); # Nathaniel Johnston, Apr 30 2011
MATHEMATICA
With[{nn=70}, Accumulate[Join[{1}, Riffle[Rest[Select[Range[nn], !Divisible[ #, 3]&]], Range[3, nn, 3], 3]]]] (* Harvey P. Dale, May 06 2012 *)
PROG
(PARI) a(n)=n*(n+1)/2+if(n%3==0, 1, 0) \\ Luc Rousseau, Jun 18 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Jul 24 2008
EXTENSIONS
a(18) corrected by Nathaniel Johnston, Apr 30 2011
STATUS
approved