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 A356150 #10 Jul 31 2022 19:54:18 %S A356150 1,3,4,10,8,12,11,25,25,18,26,28,30,33,26,56,62,61,56,56,39,63,64,67, %T A356150 62,66,72,77,80,78,57,119,139,143,137,135,134,119,134,134,134,81,120, %U A356150 138,139,147,142,146,147,148,132,153,140,157,165,165,168,174,181 %N A356150 a(n) is the sum of the positive integers whose binary expansion appears as a substring in the binary expansion of n or its complement. %C A356150 Leading 0's in binary expansions are ignored. %H A356150 Rémy Sigrist, <a href="/A356150/b356150.txt">Table of n, a(n) for n = 1..8192</a> %H A356150 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A356150 a(n) >= A078823(n). %F A356150 a(n) Sum_{k = 1..A356148(n)} A356149(n, k). %e A356150 For n = 11: %e A356150 - row 11 of A356149 is 1, 2, 3, 4, 5, 11, %e A356150 - so a(11) = 1 + 2 + 3 + 4 + 5 + 11 = 26. %o A356150 (PARI) a(n) = { my (b=binary(n)); vecsum(setbinop((i,j) -> my (s=fromdigits(b[i..j],2)); if (b[i], s, 2^(j-i+1)-1-s), [1..#b])) } %o A356150 (Python) %o A356150 def a(n): %o A356150 N = n.bit_length() %o A356150 c, s = ((1<<N)-1)^n, set() %o A356150 for i in range(N): %o A356150 for l in range(N-i): %o A356150 mask = ((2<<l)-1) << i %o A356150 s.add((mask&n) >> i) %o A356150 s.add((mask&c) >> i) %o A356150 return sum(s) %o A356150 print([a(n) for n in range(1, 60)]) # _Michael S. Branicky_, Jul 28 2022 %Y A356150 Cf. A078823, A356148, A356149. %K A356150 nonn,base %O A356150 1,2 %A A356150 _Rémy Sigrist_, Jul 28 2022