A135517 a(n) = 2^(A091090(n)-1).
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
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
- Vladimir Shevelev, Is A290646 = A135517?, Posting to Sequence Fans Mailing List, Aug 13 2017
- Vladimir Shevelev, On a Luschny question, arXiv:1708.08096 [math.NT], 2017.
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
Comments