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.

A132162 a(2n+1) = 3*a(2*n) - 4*n with a(0) = 1, a(1) = 3.

Original entry on oeis.org

1, 3, 5, 11, 7, 13, 9, 15, 17, 35, 19, 37, 21, 39, 23, 41, 25, 43, 27, 45, 29, 47, 31, 49, 33, 51, 53, 107, 55, 109, 57, 111, 59, 113, 61, 115, 63, 117, 65, 119, 67, 121, 69, 123, 71, 125, 73, 127, 75, 129, 77, 131, 79, 133, 81, 135, 83, 137, 85, 139, 87, 141, 89, 143, 91
Offset: 0

Views

Author

Paul Curtz, Nov 04 2007

Keywords

Crossrefs

Cf. A132171.

Programs

  • Maple
    f:= proc(n) option remember; local j;
    j:= (n-2) mod 6 + 2;
    if n::odd then j-1 + 3*procname(1+(n-j)/3)
    else (2*n+j)/3 + procname(1+(n-j)/3)
      fi
    end proc:
    f(0):= 1: f(1):= 3:
    map(f, [$0..100]); # Robert Israel, Feb 24 2017
  • Mathematica
    f[n_] := f[n] = With[{j = Mod[n-2, 6]+2}, If[OddQ[n], j-1 + 3*f[1+(n-j)/3], (2n+j)/3 + f[1+(n-j)/3]]];
    f[0] = 1; f[1] = 3;
    f /@ Range[0, 100] (* Jean-François Alcover, Jun 22 2020, after Maple *)

Formula

Note (a(2*n+1)-a(2*n))/2 gives A132171.
From Robert Israel, Feb 24 2017: (Start)
a(2*n) = 2*n + A132171(n) = 2*n + 3^floor(log[3](2*n+1)).
a(2*n+1) = 2*n + 3*A132171(n) = 2*n + 3*3^floor(log[3](2*n+1)).
a(6*n+2) = 4*n+2+a(2*n+1).
a(6*n+3) = 2+3*a(2*n+1).
a(6*n+4) = 4*n+4+a(2*n+1).
a(6*n+5) = 4+3*a(2*n+1).
a(6*n+6) = 4*n+6+a(2*n+1).
a(6*n+7) = 6+3*a(2*n+1).
(End)