This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A087509 #42 May 04 2023 12:25:43 %S A087509 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 A087509 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 A087509 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 A087509 Number of k such that (k*n) == 2 (mod 3) for 0 <= k <= n. %H A087509 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1). %F A087509 a(n) = Sum_{k=0..n} [(k*n) == 2 (mod 3)]; %F A087509 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 A087509 a(n) = n - A087507(n) - A087508(n). %F A087509 G.f.: x^2*(x^2+1) / ((x-1)^2*(x^2+x+1)^2). - _Colin Barker_, Mar 31 2013 %F A087509 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 A087509 a(8) = #{1,4,7} = 3. %t A087509 {#-1,1+#,0}[[Mod[#,3,1]]]/3&/@Range[0, 99] (* _Federico Provvedi_, Jun 15 2021 *) %t A087509 LinearRecurrence[{0,0,2,0,0,-1},{0,0,1,0,1,2},100] (* _Harvey P. Dale_, May 04 2023 *) %o A087509 (PARI) a(n) = sum(k=0, n, (k*n % 3)==2); \\ _Michel Marcus_, Sep 25 2017 %Y A087509 Cf. A087507, A087508. %K A087509 easy,nonn %O A087509 0,6 %A A087509 _Paul Barry_, Sep 11 2003