A352449 2^k appears in the binary expansion of a(n) iff 2^k appears in the binary expansion of n and k AND n = k (where AND denotes the bitwise AND operator).
0, 1, 0, 3, 0, 1, 4, 7, 0, 1, 0, 11, 0, 1, 4, 15, 0, 1, 0, 3, 16, 17, 20, 23, 0, 1, 0, 11, 16, 17, 20, 31, 0, 1, 0, 3, 0, 33, 4, 39, 0, 1, 0, 11, 0, 33, 4, 47, 0, 1, 0, 3, 16, 49, 20, 55, 0, 1, 0, 11, 16, 49, 20, 63, 0, 1, 0, 3, 0, 1, 68, 71, 0, 1, 0, 11, 0, 1
Offset: 0
Examples
For n = 42: - 42 = 2^5 + 2^3 + 2^1, - 42 AND 5 = 0 <> 5, - 42 AND 3 = 2 <> 3, - 42 AND 1 = 0 <> 1, - so a(42) = 0.
Links
Programs
-
PARI
a(n) = { my (v=0, m=n, k); while (m, m-=2^k=valuation(m,2); if (bitand(n, k)==k, v+=2^k)); v }
Formula
a(n) <= n with equality iff n belongs to A309274.
Comments