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.
%I A306607 #36 Mar 10 2019 23:32:23 %S A306607 0,1,1,0,1,2,-1,0,1,0,4,3,-2,-3,1,0,1,2,-3,-2,7,8,3,4,-3,-2,-7,-6,3,4, %T A306607 -1,0,1,0,6,5,-9,-10,-4,-5,11,10,16,15,1,0,6,5,-4,-5,1,0,-14,-15,-9, %U A306607 -10,6,5,11,10,-4,-5,1,0,1,2,-5,-4,16,17,10,11,-19 %N A306607 The bottom entry in the difference table of the binary digits of n. %C A306607 By convention, a(0) = 0. %C A306607 For any n > 0: let (b_0, ..., b_w) be the binary representation of n: %C A306607 - b_w = 1, and for any k = 0..w, 0 <= b_k <= 1, %C A306607 - n = Sum_{k = 0..w} b_k * 2^k, %C A306607 - a(n) is the unique value remaining after taking successively the first differences of (b_0, ..., b_w) w times. %C A306607 From _Robert Israel_, Mar 07 2019: (Start) %C A306607 If n is odd then f(A030101(n)) = (-1)^A000523(n)*f(n). %C A306607 In particular, if n is in A048701 then a(n)=0. %C A306607 a(n) == 1 (mod A014963(A000523(n))) if n is even, %C A306607 a(n) == 0 (mod A014963(A000523(n))) if n is odd. (End) %H A306607 Robert Israel, <a href="/A306607/b306607.txt">Table of n, a(n) for n = 0..10000</a> %F A306607 a(2^k) = 1 for any k >= 0. %F A306607 a(2^k-1) = 0 for any k > 1. %F A306607 a(3*2^k) = -k for any k >= 0. %F A306607 a(n) = Sum_{k=0..A000523(n)} binomial(A000523(n), k)*(-1)^k*A030302(n,k). - _David A. Corneth_, Mar 07 2019 %F A306607 G.f.: 1/(x-1)*Sum_{k>=0}(x^(2^(k+1))-x^(2^k) + x^(2^k)/(x^(2^k)+1)*Sum_{m>=k+1}(binomial(m,k)*(-1)^(m-k)*(x^(2^(m+1))-x^(2^m)))). - _Robert Israel_, Mar 07 2019 %e A306607 For n = 42: %e A306607 - the binary representation of 42 is "101010", %e A306607 - the corresponding difference table is: %e A306607 0 1 0 1 0 1 %e A306607 1 -1 1 -1 1 %e A306607 -2 2 -2 2 %e A306607 4 -4 4 %e A306607 -8 8 %e A306607 16 %e A306607 - hence a(42) = 16. %p A306607 f:= proc(n) local L; %p A306607 L:= convert(n,base,2); %p A306607 while nops(L) > 1 do %p A306607 L:= L[2..-1]-L[1..-2] %p A306607 od; %p A306607 op(L) %p A306607 end proc: %p A306607 map(f, [$0..100]); # _Robert Israel_, Mar 07 2019 %t A306607 a[n_] := NestWhile[Differences, Reverse[IntegerDigits[n, 2]], Length[#] > 1 &][[1]]; Array[a, 100, 0] (* _Amiram Eldar_, Mar 08 2019 *) %o A306607 (PARI) a(n) = if (n, my (v=Vecrev(binary(n))); while (#v>1, v=vector(#v-1, k, (v[k+1]-v[k]))); v[1], 0) %o A306607 (PARI) a(n) = my(b = binary(n), s = -1); sum(i = 1, #b, s=-s; binomial(#b-1, i-1) * b[i] * s) \\ _David A. Corneth_, Mar 07 2019 %Y A306607 Cf. A000523, A007088, A030101, A030190, A030302, A048701, A014963, A187202, A241494. %K A306607 sign,base,look %O A306607 0,6 %A A306607 _Rémy Sigrist_, Feb 28 2019