Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #23 Aug 24 2023 10:26:36
%S 1,3,2,7,15,4,31,63,127,255,5,11,511,1023,2047,4095,6,8191,16383,
%T 32767,23,65535,131071,8,17,262143,524287,1048575,2097151,4194303,
%U 8388607,16777215,9,33554431,67108863,134217727,268435455,536870911,47,1073741823,2147483647
%N 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).
%C This sequence was called the Right Arm Reach sequence in a Seqfan thread.
%C 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
%e 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.
%o (Python)
%o from itertools import islice
%o def A363584_generator():
%o alist = []
%o while True:
%o x = 1
%o while True:
%o for i,a in enumerate(alist):
%o if a <= x <= 2*a and i <= a-1:
%o x = 2*a+1
%o break
%o if x == a:
%o x += 1
%o break
%o else: break
%o yield x
%o alist.insert(0,x)
%o def A363584_list(nterms):
%o return list(islice(A363584_generator(),nterms)) # _Pontus von Brömssen_, Aug 19 2023
%K nonn
%O 1,2
%A _Ali Sada_, Aug 17 2023
%E More terms from, and name clarified by _Pontus von Brömssen_, Aug 22 2023