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.

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

This page as a plain text file.
%I A306754 #18 Mar 09 2019 00:24:32
%S A306754 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 A306754 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 A306754 -1,0,0,6,6,5,4,4,2,3,3,3,0,1,0,2,3,2,2,2,-2
%N A306754 The bottom entry in the difference table of the positions of the ones in the binary representation of n.
%C A306754 By convention, a(0) = 0.
%C A306754 For any n > 0:
%C A306754 - let (b_1, b_2, ..., b_h) be the positions of the ones in the binary representation of n,
%C A306754 - h = A000120(n) and 0 <= b_1 < b_2 < ... < b_h,
%C A306754 - n = Sum_{k = 1..h} 2^b_k,
%C A306754 - a(n) is the unique value remaining after taking successively the first differences of (b_1, ..., b_h) h-1 times.
%H A306754 Rémy Sigrist, <a href="/A306754/b306754.txt">Table of n, a(n) for n = 0..16384</a>
%F A306754 a(2^k) = k for any k >= 0.
%F A306754 a(2^k-1) = [k=2].
%F A306754 a(2*n) = a(n) + A209229(n).
%e A306754 For n = 59:
%e A306754 - the binary representation of 59 is "111011",
%e A306754 - so h = 5 and b_1 = 0, b_2 = 1, b_3 = 3, b_4 = 4, b_5 = 5,
%e A306754 - the corresponding difference table is:
%e A306754         0   1   3   4   5
%e A306754           1   2   1   1
%e A306754             1  -1   0
%e A306754              -2   1
%e A306754                 3
%e A306754 - hence a(59) = 3.
%o A306754 (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 A306754 See A306607 for a similar sequence.
%Y A306754 Cf. A000120, A133457, A209229.
%K A306754 sign,base
%O A306754 0,5
%A A306754 _Rémy Sigrist_, Mar 08 2019