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

%I #42 May 04 2023 12:25:43

%S 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,

%T 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,

%U 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

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

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1).

%F a(n) = Sum_{k=0..n} [(k*n) == 2 (mod 3)];

%F 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.

%F a(n) = n - A087507(n) - A087508(n).

%F G.f.: x^2*(x^2+1) / ((x-1)^2*(x^2+x+1)^2). - _Colin Barker_, Mar 31 2013

%F 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

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

%t {#-1,1+#,0}[[Mod[#,3,1]]]/3&/@Range[0, 99] (* _Federico Provvedi_, Jun 15 2021 *)

%t LinearRecurrence[{0,0,2,0,0,-1},{0,0,1,0,1,2},100] (* _Harvey P. Dale_, May 04 2023 *)

%o (PARI) a(n) = sum(k=0, n, (k*n % 3)==2); \\ _Michel Marcus_, Sep 25 2017

%Y Cf. A087507, A087508.

%K easy,nonn

%O 0,6

%A _Paul Barry_, Sep 11 2003

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 April 25 12:15 EDT 2024. Contains 371969 sequences. (Running on oeis4.)