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!)
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. 3
1, 3, 4, 10, 8, 12, 11, 25, 25, 18, 26, 28, 30, 33, 26, 56, 62, 61, 56, 56, 39, 63, 64, 67, 62, 66, 72, 77, 80, 78, 57, 119, 139, 143, 137, 135, 134, 119, 134, 134, 134, 81, 120, 138, 139, 147, 142, 146, 147, 148, 132, 153, 140, 157, 165, 165, 168, 174, 181 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Leading 0's in binary expansions are ignored.
LINKS
FORMULA
a(n) >= A078823(n).
a(n) Sum_{k = 1..A356148(n)} A356149(n, k).
EXAMPLE
For n = 11:
- row 11 of A356149 is 1, 2, 3, 4, 5, 11,
- so a(11) = 1 + 2 + 3 + 4 + 5 + 11 = 26.
PROG
(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])) }
(Python)
def a(n):
N = n.bit_length()
c, s = ((1<<N)-1)^n, set()
for i in range(N):
for l in range(N-i):
mask = ((2<<l)-1) << i
s.add((mask&n) >> i)
s.add((mask&c) >> i)
return sum(s)
print([a(n) for n in range(1, 60)]) # Michael S. Branicky, Jul 28 2022
CROSSREFS
Sequence in context: A328711 A361655 A343876 * A222136 A339652 A279787
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 28 2022
STATUS
approved

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 April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)