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 A355808 #10 Jul 19 2022 10:43:22 %S A355808 0,1,2,1,4,3,2,1,8,7,6,5,4,1,2,1,16,15,14,13,12,9,10,9,8,1,2,-3,4,3,2, %T A355808 1,32,31,30,29,28,25,26,25,24,17,18,13,20,19,18,17,16,1,2,-11,4,-5,-6, %U A355808 -15,8,7,6,9,4,1,2,1,64,63,62,61,60,57,58,57,56,49 %N A355808 a(n) is the number at the apex of a triangle whose base contains the distinct powers of 2 summing to n (in ascending order), and each number in a higher row is the difference of the two numbers directly below it; a(0) = 0. %H A355808 Rémy Sigrist, <a href="/A355808/b355808.txt">Table of n, a(n) for n = 0..8192</a> %H A355808 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A355808 a(n) <= n with equality iff n = 0 or n is a power of 2. %F A355808 a(2*n) = 2*a(n). %e A355808 For n = 27: %e A355808 - we have the following triangle: %e A355808 -3 %e A355808 5 2 %e A355808 1 6 8 %e A355808 1 2 8 16 %e A355808 - so a(27) = -3. %o A355808 (PARI) a(n) = { my (b=vector(hammingweight(n))); for (k=1, #b, n-=b[k]=2^valuation(n,2)); while (#b>1, b=vector(#b-1, k, b[k+1]-b[k])); if (#b, b[1], 0) } %Y A355808 See A355807 for similar sequences. %Y A355808 Cf. A348296. %K A355808 sign,base %O A355808 0,3 %A A355808 _Rémy Sigrist_, Jul 18 2022