

A087509


Number of k such that (k*n) == 2 (mod 3) for 0 <= k <= n.


5



0, 0, 1, 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 6, 0, 6, 7, 0, 7, 8, 0, 8, 9, 0, 9, 10, 0, 10, 11, 0, 11, 12, 0, 12, 13, 0, 13, 14, 0, 14, 15, 0, 15, 16, 0, 16, 17, 0, 17, 18, 0, 18, 19, 0, 19, 20, 0, 20, 21, 0, 21, 22, 0, 22, 23, 0, 23, 24, 0, 24, 25, 0, 25, 26, 0, 26, 27, 0, 27, 28, 0, 28
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,6


LINKS



FORMULA

a(n) = Sum_{k=0..n} [(k*n) == 2 (mod 3)];
a(n) = n  2*(floor(n/3) + 1)*(1  cos(2*Pi*n/3))/3  floor(n/3)*(5 + 4*cos(2*Pi*n/3))/3.
G.f.: x^2*(x^2+1) / ((x1)^2*(x^2+x+1)^2).  Colin Barker, Mar 31 2013
a(n) = 2*sin(n*Pi/3)*(sqrt(3)*cos(n*Pi) + 2*n*sin(n*Pi/3))/9.  Wesley Ivan Hurt, Sep 24 2017


EXAMPLE

a(8) = #{1,4,7} = 3.


MATHEMATICA

LinearRecurrence[{0, 0, 2, 0, 0, 1}, {0, 0, 1, 0, 1, 2}, 100] (* Harvey P. Dale, May 04 2023 *)


PROG

(PARI) a(n) = sum(k=0, n, (k*n % 3)==2); \\ Michel Marcus, Sep 25 2017


CROSSREFS



KEYWORD

easy,nonn


AUTHOR



STATUS

approved



