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-2 of 2 results.

A115716 A divide-and-conquer sequence.

Original entry on oeis.org

1, 1, 3, 1, 3, 1, 11, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 171, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 171, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 683, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1, 3, 1, 171, 1, 3, 1, 11, 1, 3, 1, 43, 1, 3, 1, 11, 1
Offset: 0

Views

Author

Paul Barry, Jan 29 2006

Keywords

Examples

			G.f. = 1 + x + 3*x^2 + x^3 + 3*x^4 + x^5 + 11*x^6 + x^7 + 3*x^8 + x^9 + ...
		

Crossrefs

Partial sums are A032925.
Row sums of number triangle A115717.
Bisection: A276390.
See A276391 for a closely related sequence.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 1,
          `if`(n::odd, 1, 4*a(n/2-1)-1))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Sep 07 2016
  • Mathematica
    a[n_] := a[n] = If[n == 0, 1, If[OddQ[n], 1, 4*a[n/2-1]-1]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 25 2017, after Alois P. Heinz *)
  • PARI
    {a(n) = if( n<1, n==0, n%2, 1, 4 * a(n/2-1) - 1)}; /* Michael Somos, Sep 07 2016 */

Formula

The g.f. G(x) satisfies G(x)-4*x^2*G(x^2)=(1+2*x)/(1+x). - Argument and offset corrected by Bill Gosper, Sep 07 2016
G.f.: 1/(1-x) + Sum_{k>=0} ((4^k-0^k)/2) *x^(2^(k+1)-2) /(1-x^(2^k)). - corrected by R. J. Mathar, Sep 07 2016
a(n)=A007583(A091090(n+1)-1). - Adapted to new offset by R. J. Mathar, Sep 07 2016
a(0) = 1, a(2*n + 1) = 1 for n>=0. a(2*n + 2) = 4*a(n) - 1 for n>=0. - Michael Somos, Sep 07 2016

A212591 a(n) is the smallest value of k for which A020986(k) = n.

Original entry on oeis.org

0, 1, 2, 5, 8, 9, 10, 21, 32, 33, 34, 37, 40, 41, 42, 85, 128, 129, 130, 133, 136, 137, 138, 149, 160, 161, 162, 165, 168, 169, 170, 341, 512, 513, 514, 517, 520, 521, 522, 533, 544, 545, 546, 549, 552, 553, 554, 597, 640, 641, 642, 645, 648, 649, 650, 661
Offset: 1

Views

Author

Michael Day, May 22 2012

Keywords

Comments

Brillhart and Morton derive an omega function for the largest values of k. This sequence appears to be given by a similar alpha function.

Crossrefs

Programs

  • J
    NB. J function on a vector
    NB. Beware round-off errors on large arguments
    NB. ok up to ~ 1e8
    alphav =: 3 : 0
    n   =. <: y
    if.+/ ntlo=. n > 0 do.
    n   =. ntlo#n
    m   =. >.-: n
    r   =. <.2^.m
    f   =. <.3%~2+2^2*>:i.>./>:r
    z   =. 0
    mi  =. m
    for_i. i.#f do.
      z   =. z + (i{f) * <.0.5 + mi =. mi%2
    end.
    nzer=. (+/ @: (0=>./\)@:|.)"1 @: #: m
    ntlo #^:_1 z - (2|n) * <.-:nzer{f
    else.
    ntlo
    end.
    )
    NB. eg    alphav 1 3 5 100 2 8 33
  • PARI
    alpha(n)={
    if(n<2, return(max(0,n-1)));
    local(nm1=n-1,
          mi=m=ceil(nm1/2),
          r=floor(log(m)/log(2)),
    i,fi,alpha=0,a);
    forstep(i=1, 2*r+1, 2,
        mi/=2;
        fi=(1+2^i)\3;
    alpha+=fi*floor(0.5+mi);
           );
    alpha*=2;
    if(nm1%2,   \\ adjust for even n
       a=factor(2*m)[1,2]-1;
    alpha-= (1+2^(1+2*a))\3;
      );
    return(alpha);
    }
    

Formula

a(2*n-1) - a(2*n-2) = (2^(2*k+1)+1)/3 and a(2*n) - a(2*n-1) = (2^(2*k+1)+1)/3 with a(0) = a(1) = 0, where n = (2^k)*(2*m-1) for some integers k >= 0 and m > 0.
Restating the formula above, a(n+1) - a(n) = A007583(A050605(n-1)) = A276391 with terms repeated. - John Keith, Mar 04 2021

Extensions

Minor edits by N. J. A. Sloane, Jun 06 2012
Showing 1-2 of 2 results.