login
A143101
Partial sums of A143097.
3
1, 3, 7, 10, 15, 22, 28, 36, 46, 55, 66, 79, 91, 105, 121, 136, 153, 172, 190, 210, 232, 253, 276, 301, 325, 351, 379, 406, 435, 466, 496, 528, 562, 595, 630, 667, 703, 741, 781, 820, 861, 904, 946, 990, 1036, 1081, 1128, 1177, 1225, 1275, 1327, 1378, 1431
OFFSET
1,2
LINKS
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]
a(n) = n*(n+1)/2 + (3|n) = A000217(n) + A079978(n). - Luc Rousseau, Jun 18 2017
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
Sequence in context: A085145 A320441 A353654 * A307612 A330160 A373186
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Jul 24 2008
EXTENSIONS
a(18) corrected by Nathaniel Johnston, Apr 30 2011
STATUS
approved