OFFSET
0,7
COMMENTS
To compute a(n): replace every other bit with zero (starting with the first bit) in each run of consecutive 1's in the binary expansion of n.
LINKS
FORMULA
EXAMPLE
The first terms, in binary and in decimal, are:
n a(n) bin(n) bin(a(n))
-- ---- ------ ---------
0 0 0 0
1 0 1 0
2 0 10 0
3 1 11 1
4 0 100 0
5 0 101 0
6 2 110 10
7 2 111 10
8 0 1000 0
9 0 1001 0
10 0 1010 0
11 1 1011 1
12 4 1100 100
13 4 1101 100
14 4 1110 100
15 5 1111 101
16 0 10000 0
PROG
(PARI) a(n) = { my (v = 0, e, x, y, b); while (n, x = y = 0; e = valuation(n, 2); for (k = 0, oo, if (bittest(n, e+k), n -= b = 2^(e+k); [x, y] = [y + b, x], v += y; break; ); ); ); return (v); }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 06 2024
STATUS
approved