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.

A123919 Number of numbers congruent to 2 or 4 mod 6 and <= n.

Original entry on oeis.org

0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 16, 16, 16, 16, 17, 17, 18, 18, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 22, 22, 22, 22, 23, 23, 24, 24, 24, 24, 25, 25, 26, 26, 26
Offset: 1

Views

Author

Giovanni Teofilatto, Oct 29 2006

Keywords

Comments

First differences of A056827. - R. J. Mathar, Nov 22 2008
a(n+2) is the graph radius of the n X n knight graph for n > 7. - Eric W. Weisstein, Nov 20 2019

Crossrefs

Programs

  • GAP
    a:=[0,1,1,2,2,2,2];; for n in [8..80] do a[n]:=a[n-1]+a[n-6]-a[n-7]; od; a; # G. C. Greubel, Aug 07 2019
    
  • Magma
    [Floor(n/2) - Floor(n/6) : n in [1..100]]; // Wesley Ivan Hurt, Apr 26 2021
  • Mathematica
    a[n_] := Floor[n/2] - Floor[n/6]; Array[a, 80] (* Robert G. Wilson v, Oct 29 2006 *)
    LinearRecurrence[{1, 0, 0, 0, 0, 1, -1}, {0, 1, 1, 2, 2, 2, 2}, 80] (* G. C. Greubel, Aug 07 2019 *)
  • PARI
    my(x='x+O('x^80)); concat([0], Vec(x^2*(1+x^2)/((1-x)*(1-x^6)))) \\ G. C. Greubel, Aug 07 2019
    
  • PARI
    a(n) = floor(n/2) - floor(n/6);  \\ Joerg Arndt, Nov 23 2019
    

Formula

a(n) = floor(n/2) - floor(n/6).
From R. J. Mathar, Nov 22 2008: (Start)
G.f.: x^2*(1+x^2)/((1+x)*(1-x)^2*(1+x+x^2)*(1-x+x^2)).
a(n+1) - a(n) = A120325(n+1). (End)
a(n) = A004526(n) - A152467(n). - Omar E. Pol, Nov 25 2019
a(n) = a(n-1)+a(n-6)-a(n-7). - Wesley Ivan Hurt, Apr 26 2021
a(n) = floor((2*n+3+(-1)^n)/6). - Adriano Caroli, Mar 14 2025