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.

A209247 a(n) = p(p(n)) + p(p( abs(n - p(p(n-1))) )), where p(n) = A188163(n) + 1 - [n=1].

Original entry on oeis.org

1, 23, 33, 40, 61, 62, 65, 80, 115, 116, 117, 120, 125, 128, 141, 199, 228, 229, 230, 231, 234, 237, 238, 241, 246, 249, 264, 286, 289, 304, 370, 403, 449, 450, 451, 452, 453, 456, 459, 460, 461, 464, 469, 470, 473, 483, 486, 496, 518, 519, 522, 527, 530, 543
Offset: 2

Views

Author

Roger L. Bagula, Jan 13 2013

Keywords

Crossrefs

Programs

  • Magma
    nmax:=200;
    h:=[n le 2 select 1 else Self(Self(n-1)) + Self(n - Self(n-1)): n in [1..10*nmax]]; // h = A004001
    A188163:= function(n)
       for j in [1..8*nmax+1] do
           if h[j] eq n then return j; end if;
       end for;
    end function;
    // define a sequence based on A188163
    p:= func< n | A188163(n) + 1 - 0^(n-1) >;
    A209247:= function(n)
       if n le 2 then return 1;
       else return p(p(n)) + p(p(Abs(n - p(p(n-1)))));
       end if;
    end function;
    [A209247(n): n in [2..nmax]]; // G. C. Greubel, May 20 2024
    
  • Mathematica
    nmax := 200;
    h[n_]:= h[n]= If[n<3, 1, h[h[n-1]] + h[n-h[n-1]]]; (* A004001 *)
    A188163[n_]:= For[m=1, True, m++, If[h[m]==n, Return[m]]];
    (* define a sequence from A188163 *)
    p[n_]:= A188163[n] + 1 - Boole[n==1];
    a[n_]:= a[n]= If[n<3, 1, p[p[n]] + p[p[Abs[n-p[p[n-1]]]]]];
    Table[a[n], {n, 2, nmax}]
  • SageMath
    @CachedFunction
    def h(n): return 1 if (n<3) else h(h(n-1)) + h(n - h(n-1)) # h=A004001
    def A188163(n):
        for j in range(1,2*n+1):
            if h(j)==n: return j
    # define a function based on A188163
    def p(n): return A188163(n) + 1 - int(n==1)
    @CachedFunction
    def A209247(n): return 1 if (n<3) else p(p(n)) + p(p(abs(n - p(p(n-1)))))
    [A209247(n) for n in range(2,201)] # G. C. Greubel, May 20 2024

Extensions

Edited by G. C. Greubel, Apr 23 2024