cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Paul Barry, Sep 11 2003

Keywords

Examples

			a(4) = 2 because k=1 and k=4 satisfy the equation.
		

Crossrefs

Programs

  • 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
    
  • Mathematica
    LinearRecurrence[{0,0,2,0,0,-1}, {0,1,1,0,2,2}, 100] (* Vincenzo Librandi, Sep 22 2015 *)
    Table[PadRight[{0},3,n],{n,30}]//Flatten (* Harvey P. Dale, Jan 27 2021 *)
  • PARI
    concat(0,Vec((1+x)/(1-x^3)^2 +O(x^99))) \\ Charles R Greathouse IV, Oct 24 2014
    
  • PARI
    a(n) = sum(k=0, n, Mod(k*n, 3)==1); \\ Michel Marcus, Sep 27 2017
    
  • SageMath
    @CachedFunction
    def A087508(n):
        if (n<6): return (0,1,1,0,2,2)[n]
        else: return 2*A087508(n-3) - A087508(n-6)
    [A087508(n) for n in (0..100)] # G. C. Greubel, Sep 02 2022

Formula

a(n) = A000027(n) - A087509(n) - A087507(n).
a(n) = (2/3)*(floor(n/3)+1)*(1-cos(2*Pi*n/3)).
G.f.: x*(1 + x)/(1 - x^3)^2. - Arkadiusz Wesolowski, May 28 2013
a(n) = sin(n*Pi/3)*((4n+6)*sin(n*Pi/3)-sqrt(3)*cos(n*Pi))/9. - Wesley Ivan Hurt, Sep 24 2017

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

Original entry on oeis.org

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
Offset: 0

Views

Author

Paul Barry, Sep 11 2003

Keywords

Examples

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

Crossrefs

Programs

  • 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 *)
  • PARI
    a(n) = sum(k=0, n, (k*n % 3)==2); \\ Michel Marcus, Sep 25 2017

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

A087620 #{0<=k<=n: k*n is divisible by 4}.

Original entry on oeis.org

1, 1, 2, 1, 5, 2, 4, 2, 9, 3, 6, 3, 13, 4, 8, 4, 17, 5, 10, 5, 21, 6, 12, 6, 25, 7, 14, 7, 29, 8, 16, 8, 33, 9, 18, 9, 37, 10, 20, 10, 41, 11, 22, 11, 45, 12, 24, 12, 49, 13, 26, 13, 53, 14, 28, 14, 57, 15, 30, 15, 61, 16, 32, 16, 65, 17, 34, 17, 69, 18, 36, 18, 73, 19, 38, 19, 77, 20
Offset: 0

Views

Author

Paul Barry, Sep 13 2003

Keywords

Comments

With the similar remainder 1, 2 and 3 sequences provides a four-fold partition of A000027.

Crossrefs

Programs

  • Magma
    I:=[1,1,2,1,5,2,4,2]; [n le 8 select I[n] else 2*Self(n-4)-Self(n-8): n in [1..80]]; // Vincenzo Librandi, May 03 2015
  • Mathematica
    CoefficientList[Series[(3 x^4 + x^3 + 2 x^2 + x + 1)/((x - 1)^2 (x + 1)^2 (x^2 + 1)^2), {x, 0, 80}], x] (* Vincenzo Librandi, May 03 2015 *)
  • PARI
    Vec((3*x^4+x^3+2*x^2+x+1)/((x-1)^2*(x+1)^2*(x^2+1)^2) + O(x^100)) \\ Colin Barker, May 03 2015
    

Formula

a(n) = Sum_{k=0..n} if (k*n mod 4 = 0, 1, 0).
From Colin Barker, May 03 2015: (Start)
a(n) = (6+4*n+i^n*(-i+n)+(-i)^n*(i+n)+2*(-1)^n*(1+n))/8 where i=sqrt(-1).
a(n) = 2*a(n-4)-a(n-8) for n>7.
G.f.: (3*x^4+x^3+2*x^2+x+1) / ((x-1)^2*(x+1)^2*(x^2+1)^2).
(End)
Showing 1-3 of 3 results.