The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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.
a(n) = n - A087507(n) - A087508(n).
G.f.: x^2*(x^2+1) / ((x-1)^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
{#-1, 1+#, 0}[[Mod[#, 3, 1]]]/3&/@Range[0, 99] (* Federico Provvedi, Jun 15 2021 *)
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
Sequence in context: A281260 A182406 A160706 * A274097 A265400 A181871
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Sep 11 2003
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 17 23:39 EDT 2024. Contains 372608 sequences. (Running on oeis4.)