login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A377463
Numbers that are not the sum of distinct powers of 4.
1
2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 70, 71, 72, 73, 74, 75, 76, 77, 78
OFFSET
1,1
COMMENTS
Complement of the Moser-de Bruijn sequence (A000695).
Numbers whose base 4 digits contain either 2 or 3.
PROG
(Python)
from gmpy2 import digits
def A377463(n):
def f(x):
s = digits(x, 4)
for i in range(l:=len(s)):
if s[i]>'1':
break
else:
return n+int(s, 2)
return n-1+(int(s[:i] or '0', 2)+1<<l-i)
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m
(Python)
from itertools import count, islice
from gmpy2 import digits
def is_A377463(n): return max(digits(n, 4))>'1'
def A377463_gen(): # generator of terms
return filter(is_A377463, count(1))
A377463_list = list(islice(A377463_gen(), 50))
CROSSREFS
Cf. A000695, A074940 (base 3 analog), A136399 (base 10 analog).
Sequence in context: A225755 A126388 A039247 * A371292 A039189 A039141
KEYWORD
nonn,easy
AUTHOR
Chai Wah Wu, Oct 29 2024
STATUS
approved