login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306754 The bottom entry in the difference table of the positions of the ones in the binary representation of n. 1

%I #18 Mar 09 2019 00:24:32

%S 0,0,1,1,2,2,1,0,3,3,2,1,1,-1,0,0,4,4,3,2,2,0,1,1,1,-2,-1,-2,0,1,0,0,

%T 5,5,4,3,3,1,2,2,2,-1,0,-1,1,2,1,1,1,-3,-2,-4,-1,-1,-2,-3,0,2,1,3,0,

%U -1,0,0,6,6,5,4,4,2,3,3,3,0,1,0,2,3,2,2,2,-2

%N The bottom entry in the difference table of the positions of the ones in the binary representation of n.

%C By convention, a(0) = 0.

%C For any n > 0:

%C - let (b_1, b_2, ..., b_h) be the positions of the ones in the binary representation of n,

%C - h = A000120(n) and 0 <= b_1 < b_2 < ... < b_h,

%C - n = Sum_{k = 1..h} 2^b_k,

%C - a(n) is the unique value remaining after taking successively the first differences of (b_1, ..., b_h) h-1 times.

%H Rémy Sigrist, <a href="/A306754/b306754.txt">Table of n, a(n) for n = 0..16384</a>

%F a(2^k) = k for any k >= 0.

%F a(2^k-1) = [k=2].

%F a(2*n) = a(n) + A209229(n).

%e For n = 59:

%e - the binary representation of 59 is "111011",

%e - so h = 5 and b_1 = 0, b_2 = 1, b_3 = 3, b_4 = 4, b_5 = 5,

%e - the corresponding difference table is:

%e 0 1 3 4 5

%e 1 2 1 1

%e 1 -1 0

%e -2 1

%e 3

%e - hence a(59) = 3.

%o (PARI) a(n) = { my (h=hammingweight(n), o=0, v=0); forstep (k=h-1, 0, -1, my (w=valuation(n, 2)); o += w; v += (-1)^k * binomial(h-1, k) * o; o++; n\=2^(1+w)); v };

%Y See A306607 for a similar sequence.

%Y Cf. A000120, A133457, A209229.

%K sign,base

%O 0,5

%A _Rémy Sigrist_, Mar 08 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 21 22:52 EDT 2024. Contains 375353 sequences. (Running on oeis4.)