OFFSET
1,3
COMMENTS
Leading zeros in binary expansions are ignored.
For any n > 0, there are A274005(n)/2 positive terms with binary length n.
Empirically, if t is a term, then at least one of 2*t or 2*t + 1 is also a term.
If t is a term, then floor(t/2) is also a term.
The complement with respect to the nonnegative integers is 56, 71, 112, 113, 120, 135, 142, 143, 176, 184, 199, ... - Andrew Howroyd, Oct 09 2024
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..7658
Rémy Sigrist, PARI program
EXAMPLE
For k = 12:
- the binary expansion of k is "1100",
- blocks of length 1 have Hamming weight 0 or 1,
- blocks of length 2 have Hamming weight 0, 1 or 2,
- blocks of length 3 have Hamming weight 1 or 2,
- blocks of length 4 have Hamming weight 2,
- so 12 belongs to the sequence.
For k = 56:
- the binary expansion of 44 is "111000",
- blocks of length 3 have Hamming weight 0, 1, 2 or 3,
- so 56 does not belong to the sequence.
PROG
(PARI) \\ See Links section.
(Python)
def ok(n):
b = bin(n)[2:]
if "000" in b and "111" in b: return False
for l in range(4, len(b)-1):
h = set(b[i:i+l].count("1") for i in range(len(b)-l+1))
if max(h) - min(h) > 2: return False
return True
print([k for k in range(69) if ok(k)]) # Michael S. Branicky, Oct 12 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 12 2022
EXTENSIONS
a(69) onwards from Andrew Howroyd, Oct 09 2024
STATUS
approved