OFFSET
1,2
COMMENTS
Sequence is a permutation of the positive integers. A115511 is the inverse permutation.
This can be regarded as a set-theoretic analog of A064413. - N. J. A. Sloane, Sep 06 2021
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..1025
FORMULA
(4,6,5) is a 3-cycle and (2^k,2^k+1) for k = 1 and k > 2 are 2-cycles; all other numbers are fixed points. - Klaus Brockhaus, Jan 24 2006
In other words, a(2^k)=2^k+1 for k >= 3, a(2^k+1) = 2^k for k>=3, and otherwise a(n) = n for n >= 7. - N. J. A. Sloane, Mar 25 2022
EXAMPLE
a(3) = 2 = 10 in binary. Among the positive integers not occurring among the first 3 terms of the sequence (4 = 100 in binary, 5 = 101 in binary, 6 = 110 in binary,...), 6 is the smallest that shares at least one 1-bit with a(3) when written in binary. So a(4) = 6.
MATHEMATICA
Block[{a = {1}, k}, Do[k = 1; While[Or[BitAnd[Last@ a, k ] == 0, MemberQ[a, k]], k++]; AppendTo[a, k], {71}]; a] (* Michael De Vlieger, Sep 07 2017 *)
PROG
(Python)
A115510_list, l1, s, b = [1], 1, 2, set()
for _ in range(10**6):
i = s
while True:
if not i in b and i & l1:
A115510_list.append(i)
l1 = i
b.add(i)
while s in b:
b.remove(s)
s += 1
break
i += 1 # Chai Wah Wu, Sep 24 2021
CROSSREFS
KEYWORD
easy,base,nonn
AUTHOR
Leroy Quet, Jan 23 2006
EXTENSIONS
More terms from Klaus Brockhaus, Jan 24 2006
STATUS
approved