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.

A216972 a(4n+2) = 2, otherwise a(n) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 2, 7, 8, 9, 2, 11, 12, 13, 2, 15, 16, 17, 2, 19, 20, 21, 2, 23, 24, 25, 2, 27, 28, 29, 2, 31, 32, 33, 2, 35, 36, 37, 2, 39, 40, 41, 2, 43, 44, 45, 2, 47, 48, 49, 2, 51, 52, 53, 2, 55, 56, 57, 2, 59, 60, 61, 2, 63, 64, 65, 2, 67, 68, 69, 2
Offset: 0

Views

Author

Paul Curtz, Sep 21 2012

Keywords

Comments

For n>0, a(n) is the denominator of A214282(n)/(-A214283(n+1)):
1/1, 1/2, 1/3, 3/4, 3/5, 1/2, 3/7, 5/8, 5/9, ...
For n>0, a(n) is the denominator of A214283(n)/A214283(n+1):
0/1, 1/2, 2/3, 3/4, 2/5, 1/2, 4/7, 5/8, 4/9, ...
a(n), first and second differences:
0, 1, 2, 3, 4, 5, 2, 7, 8, 9, 2, 11, 12, ...
1, 1, 1, 1, 1, -3, 5, 1, 1, -7, 9, 1, 1, ...
0, 0, 0, 0, -4, 8, -4, 0, -8, 16, -8, 0, -12, ...

Crossrefs

Programs

  • Magma
    [n mod 4 eq 2 select 2 else n: n in [0..70]]; // Bruno Berselli, Sep 26 2012
    
  • Mathematica
    a[n_] := If[Mod[n, 4] == 2, 2, n]; Table[a[n], {n, 0, 81}] (* Jean-François Alcover, Sep 25 2012 *)
    LinearRecurrence[{0,0,0,2,0,0,0,-1},{0,1,2,3,4,5,2,7},80] (* Harvey P. Dale, Nov 06 2017 *)
  • Maxima
    makelist(expand(2+(4-(1+(-1)^n)*(1-%i^n))*(n-2)/4), n, 0, 70); /* Bruno Berselli, Sep 26 2012 */
    
  • Python
    def A216972(n): return 2 if n&3==2 else n # Chai Wah Wu, Jan 31 2024

Formula

a(n) = 2*a(n-4) - a(n-8).
a(n+4) - a(n) = 4*A152822(n).
a(2n) + a(2n+1) = |A141124(n)|.
a(4n) + a(4n+1) + a(4n+2) + a(4n+3) = 6*A005408(n) = A017593(n).
G.f.: (x+2*x^2+3*x^3+4*x^4+3*x^5-2*x^6+x^7) / (1-2*x^4+x^8). - Jean-François Alcover, Sep 25 2012
a(n) = 2+(4-(1+(-1)^n)*(1-i^n))*(n-2)/4, where i=sqrt(-1). - Bruno Berselli, Sep 26 2012
a(2n) = 2*|A009531(n)|, a(2n+1) = 2n+1. - Bruno Berselli, Sep 27 2012