OFFSET
1,2
COMMENTS
a(n) is the smallest number such that a(n)>a(n-1) and a(n)'s k-th binary digit is 1, for some k different from a(1),a(2),...,a(n-1).
The first 2^n-1 terms of A334992 are the nonzero partial sums of {2^a(1), 2^a(2), ..., 2^a(n)}.
2^n is in the sequence if and only if n isn't in the sequence.
Let G(n) be the number of terms in the sequence among 0,1,2,..,n-1. Then G(2^n)=2^n-2^G(n).
G(n)/n seems to be 1-(1/n)^(1/log(n))^(1/loglog(n))^(1/logloglog(n))^... asymptotically (all logs are base 2).
LINKS
Alon Heller, Table of n, a(n) for n = 1..65536
EXAMPLE
a(2)=2 because 2 is the smallest number > 0 which isn't a partial sum of {1}={2^0}.
a(4)=6 because 6 is the smallest number > 3 which isn't a partial sum of {1,4,8}={2^0,2^2,2^3}.
PROG
(Python)
def gen():
"""Generates the terms of A335033, starting with 1"""
A334992 = [0, 1]
A335033 = [0, 2]
yield 0
yield 2
power_index = 1
while True:
new_power = 2 ** A335033[power_index]
for i in range(len(A334992)):
if A335033[-1] != x:
A335033.append(x)
yield x
power_index += 1
def A335033_list(n):
"""Returns the n first elements as a list"""
g = gen()
return [next(g) for _ in range(n)]
print(A335033_list(20))
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Alon Heller, May 20 2020
STATUS
approved