A337582 Numbers m such that m AND (m*2^k) is zero or a power of 2 for any k > 0 (where AND denotes the bitwise AND operator).
0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 22, 24, 25, 26, 32, 33, 34, 35, 36, 37, 38, 40, 41, 44, 48, 49, 50, 52, 64, 65, 66, 67, 68, 69, 70, 72, 74, 76, 80, 81, 82, 83, 88, 96, 97, 98, 100, 101, 104, 128, 129, 130, 131, 132, 133, 134, 136
Offset: 1
Examples
Regarding 7: - 7 AND 14 = 6, which is neither 0 nor a power of 2, - so 7 does not belong to the sequence. Regarding 13: - we have the following values: k 13 AND (13*2^k) --- --------------- 1 2^3 2 2^2 3 2^3 >=4 0 - so 13 belongs to the sequence.
Links
Crossrefs
Cf. A308251.
Programs
-
PARI
is(n) = { my (m=n); while (m>>=1, if (hammingweight(bitand(m,n))>1, return (0))); return (1) }
Comments