login
A363584
Lexicographically least sequence of distinct positive integers, subject to the constraint that if 1 <= k <= a(m), then either a(m+k) < a(m) or a(m+k) > 2*a(m).
0
1, 3, 2, 7, 15, 4, 31, 63, 127, 255, 5, 11, 511, 1023, 2047, 4095, 6, 8191, 16383, 32767, 23, 65535, 131071, 8, 17, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 9, 33554431, 67108863, 134217727, 268435455, 536870911, 47, 1073741823, 2147483647
OFFSET
1,2
COMMENTS
This sequence was called the Right Arm Reach sequence in a Seqfan thread.
Every positive integer appears, and the index at which k appears is at most k*(k+1)/2. - Pontus von Brömssen, Aug 22 2023
EXAMPLE
Each positive integer k has k "right arm reach". And numbers between k+1 and 2k cannot be within k's right arm reach. We start with a(1) = 1. Now, 2 cannot follow directly because the second position is within the right arm reach of 1. So, a(2) = 3. This step will send 4, 5, and 6 to the "bullpen" waiting for their turns, while 2 can go back to the field since it's out of 1's right arm reach now. a(3) = 2. After that, the least positive integer that's not in the bullpen is 7, so, a(4) = 7. This step will send all the numbers between 8 and 14 to the bullpen. Since we are now in the 3's and 7's right arm reaches, the least available positive integer is 15. So, a(5) = 15. And now we are outside of the 3's right arm reach, so, 4 comes out of the bullpen and a(6) = 4. And so on.
PROG
(Python)
from itertools import islice
def A363584_generator():
alist = []
while True:
x = 1
while True:
for i, a in enumerate(alist):
if a <= x <= 2*a and i <= a-1:
x = 2*a+1
break
if x == a:
x += 1
break
else: break
yield x
alist.insert(0, x)
def A363584_list(nterms):
return list(islice(A363584_generator(), nterms)) # Pontus von Brömssen, Aug 19 2023
CROSSREFS
Sequence in context: A320769 A358283 A390815 * A365279 A260141 A344494
KEYWORD
nonn
AUTHOR
Ali Sada, Aug 17 2023
EXTENSIONS
More terms from, and name clarified by Pontus von Brömssen, Aug 22 2023
STATUS
approved