login
A023715
Numbers with exactly 2 2's in their base 4 expansion.
2
10, 26, 34, 38, 40, 41, 43, 46, 58, 74, 90, 98, 102, 104, 105, 107, 110, 122, 130, 134, 136, 137, 139, 142, 146, 150, 152, 153, 155, 158, 160, 161, 163, 164, 165, 167, 172, 173, 175, 178, 182, 184, 185, 187, 190, 202, 218, 226, 230, 232, 233, 235, 238, 250, 266
OFFSET
1,1
LINKS
MAPLE
q:= n-> numboccur(convert(n, base, 4), 2)=2:
select(q, [$1..350])[]; # Alois P. Heinz, Oct 26 2022
MATHEMATICA
Select[ Range[ 240 ], (Count[ IntegerDigits[ #, 4 ], 2 ]==2)& ]
PROG
(Python)
def ok(n):
mask, c = 3, 0
for i in range(n.bit_length() >> 1):
if (mask&n) >> (i << 1) == 2: c += 1
mask <<= 2
return c == 2
print([k for k in range(227) if ok(k)]) # Michael S. Branicky, Oct 26 2022
CROSSREFS
Sequence in context: A337049 A067264 A043342 * A045143 A005278 A339977
KEYWORD
nonn,base,easy
STATUS
approved