login
A328379
a(n) is the sum of the distinct numbers whose binary digits appear in order but not necessarily as consecutive digits in the binary representation of n.
2
0, 1, 3, 4, 7, 11, 12, 11, 15, 24, 31, 29, 28, 37, 33, 26, 31, 49, 66, 61, 71, 92, 85, 67, 60, 87, 103, 90, 77, 95, 78, 57, 63, 98, 133, 121, 150, 191, 177, 138, 151, 215, 254, 219, 197, 240, 199, 145, 124, 185, 237, 210, 235, 293, 262, 199, 165, 230, 263, 223
OFFSET
0,3
FORMULA
A078823(n) <= a(n).
a(2^k) = 2^(k+1)-1 for any k >= 0.
a(2^k-1) = A000295(k+1) for any k >= 0.
EXAMPLE
The first terms, alongside the binary representations of n as well as those of the numbers that appear in it, are:
n a(n) bin(n) {bin(s)}
-- ---- ------ ----------------------------
0 0 0 {0}
1 1 1 {1}
2 3 10 {0, 1, 10}
3 4 11 {1, 11}
4 7 100 {0, 1, 10, 100}
5 11 101 {0, 1, 10, 11, 101}
6 12 110 {0, 1, 10, 11, 110}
7 11 111 {1, 11, 111}
8 15 1000 {0, 1, 10, 100, 1000}
9 24 1001 {0, 1, 10, 11, 100, 101, 1001}
10 31 1010 {0, 1, 10, 11, 100, 101, 110, 1010}
PROG
(PARI) a(n, base=2) = { my (b=digits(n, base), s=[0]); for (k=1, #b, s = setunion(s, apply(o -> base*o+b[k], s))); vecsum(s) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Nov 30 2019
STATUS
approved