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 A087508 #40 Sep 08 2022 08:45:11 %S A087508 0,1,1,0,2,2,0,3,3,0,4,4,0,5,5,0,6,6,0,7,7,0,8,8,0,9,9,0,10,10,0,11, %T A087508 11,0,12,12,0,13,13,0,14,14,0,15,15,0,16,16,0,17,17,0,18,18,0,19,19,0, %U A087508 20,20,0,21,21,0,22,22,0,23,23,0,24,24,0,25,25,0,26,26,0,27,27,0,28,28,0 %N A087508 Number of k such that mod(k*n,3) = 1 for 0 <= k <= n. %H A087508 G. C. Greubel, <a href="/A087508/b087508.txt">Table of n, a(n) for n = 0..10000</a> %H A087508 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1). %F A087508 a(n) = A000027(n) - A087509(n) - A087507(n). %F A087508 a(n) = (2/3)*(floor(n/3)+1)*(1-cos(2*Pi*n/3)). %F A087508 G.f.: x*(1 + x)/(1 - x^3)^2. - _Arkadiusz Wesolowski_, May 28 2013 %F A087508 a(n) = sin(n*Pi/3)*((4n+6)*sin(n*Pi/3)-sqrt(3)*cos(n*Pi))/9. - _Wesley Ivan Hurt_, Sep 24 2017 %e A087508 a(4) = 2 because k=1 and k=4 satisfy the equation. %t A087508 LinearRecurrence[{0,0,2,0,0,-1}, {0,1,1,0,2,2}, 100] (* _Vincenzo Librandi_, Sep 22 2015 *) %t A087508 Table[PadRight[{0},3,n],{n,30}]//Flatten (* _Harvey P. Dale_, Jan 27 2021 *) %o A087508 (PARI) concat(0,Vec((1+x)/(1-x^3)^2 +O(x^99))) \\ _Charles R Greathouse IV_, Oct 24 2014 %o A087508 (PARI) a(n) = sum(k=0, n, Mod(k*n, 3)==1); \\ _Michel Marcus_, Sep 27 2017 %o A087508 (Magma) I:=[0,1,1,0,2,2]; [n le 6 select I[n] else 2*Self(n-3) - Self(n-6): n in [1..100]]; // _Vincenzo Librandi_, Sep 22 2015 %o A087508 (SageMath) %o A087508 @CachedFunction %o A087508 def A087508(n): %o A087508 if (n<6): return (0,1,1,0,2,2)[n] %o A087508 else: return 2*A087508(n-3) - A087508(n-6) %o A087508 [A087508(n) for n in (0..100)] # _G. C. Greubel_, Sep 02 2022 %Y A087508 Cf. A000027, A087507, A087509. %K A087508 easy,nonn %O A087508 0,5 %A A087508 _Paul Barry_, Sep 11 2003