OFFSET
0,2
COMMENTS
k mod 3 is periodic: 0,1,2, 0,1,2, 0,1,2, 0,1,2, 0,1,2, 0,1,2.
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
k*(1 + k)*(1 + 2*k) is multiple of 18; a(0..2)=0,4,8; a(n) = a(n-3) + 9 for n > 2.
a(n) = 3*(n-floor(n/3)) + n. - Gary Detlefs, Mar 27 2010
a(n) = 3*n + A010872(n). - Wesley Ivan Hurt, Jul 07 2013
G.f.: x*(x+2)^2 / ( (1+x+x^2)*(x-1)^2 ). - R. J. Mathar, Jul 13 2013
MAPLE
seq(3*(n-floor(n/3)) +n, n= 0..61); # Gary Detlefs, Mar 27 2010
MATHEMATICA
s={}; Do[If[Mod[m*(1+m)*(1+2*m), 18]==0, s={s, m}], {m, 0, 400}]; Flatten[s]
Flatten[Position[Accumulate[Range[0, 200]^2], _?(Mod[#, 3]==0&)]]-1 (* or *) LinearRecurrence[{1, 0, 1, -1}, {0, 4, 8, 9}, 100] (* Harvey P. Dale, Mar 08 2018 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Zak Seidov, May 23 2008
STATUS
approved