[go: up one dir, main page]

login
A335033
a(n) is the smallest number larger than a(n-1) that is not a partial sum of 2^a(1),2^a(2),...,2^a(n-1), with a(1)=0.
2
0, 2, 3, 6, 7, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 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
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).
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)):
A334992.append(A334992[i] + new_power)
for x in range(A334992[-2] + 1, A334992[-1]):
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
Complement of A334992.
Sequence in context: A188084 A242750 A299239 * A107998 A276884 A053438
KEYWORD
nonn,base,easy
AUTHOR
Alon Heller, May 20 2020
STATUS
approved