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.

A135517 a(n) = 2^(A091090(n)-1).

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 4, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 32, 1, 2, 1, 4, 1, 2, 1, 8
Offset: 0

Views

Author

N. J. A. Sloane, based on a message from Guy Steele and Don Knuth, Mar 01 2008

Keywords

Comments

Also, a(n) = denominator(Euler(n, x) - Euler(n, 1)). - Observation from Peter Luschny, Aug 08 2017, proof from Vladimir Shevelev, Aug 13 2017
Also, a(n) = denominator(Euler(n,x) + Euler(n,0)). - Vladimir Shevelev, Aug 09 2017

Crossrefs

This is Guy Steele's sequence GS(2, 5) (see A135416).
Cf. A091090.

Programs

  • Maple
    GS(2,5,200); # see A135416.
    a := n -> `if`(n=1 or n mod 2 = 0, 1, 2*a(iquo(n,2))):
    seq(a(n), n=0..103); # Peter Luschny, Aug 09 2017
  • Mathematica
    b[n_] := b[n] = Which[n==0, 1, n==1, 1, EvenQ[n], 1, True, b[(n-1)/2] + 1]; a[n_] := 2^(b[n+1]-1); Array[a,103,0] (* Jean-François Alcover, Aug 12 2017 *)
  • PARI
    a(n)=my(m=valuation(n+1,2)); 2^if(n>>m, m, m-1) \\ Charles R Greathouse IV, Aug 15 2017
    
  • Python
    def A135517(n): return (1<<(~(n+1)&n).bit_length()-(not n&(n+1))) if n else 1 # Chai Wah Wu, Sep 18 2024

Formula

For n >= 1, a(n) = 2^max_{odd k=1..n} (A007814(k+1) - t(n,k) - delta(n,k)), where delta(n,k) is the Kronecker symbol: delta(i,j) is 1 if i=j and 0 otherwise, and t(n,k) is the number of carries which appear in the addition of k and n-k in base 2. This allows us to answer in the affirmative the author's question (for a proof see Shevelev's link and its continuations). - Vladimir Shevelev, Aug 15 2017

Extensions

Entry revised by N. J. A. Sloane, Aug 31 2017