Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #25 Apr 20 2024 03:01:12
%S 1,7,2,5,13,3,67,35,11,33,4,31,6,29,8,27,63,25,327,23,61,21,325,19,59,
%T 17,323,15,57,9,321,175,55,173,15490,171,53,169,317,167,51,165,1167,
%U 163,49,161,10,159,47,157,12,155,45,153,14,151,16,149,18,147,20,145,22,143,24,141,26,139,28,137,30,135,32,133,34
%N a(n) = index of n in A368382, or -1 if n is missing from that sequence.
%H Chai Wah Wu, <a href="/A368383/b368383.txt">Table of n, a(n) for n = 1..10000</a>
%o (Python)
%o from itertools import count
%o def A368383(n):
%o a, aset, p = 1, {0,1}, 2
%o for c in count(1):
%o if a==n: return c
%o for b in count(a%p,p):
%o if b not in aset:
%o aset.add(b)
%o a, p = b, 3 if p == 2 else p+2
%o break # _Chai Wah Wu_, Mar 05 2024
%o (Python) # faster for initial segment of sequence
%o def A368383_gen(): # uses A368382_gen/imports from _Chai Wah Wu_ in A368382
%o adict, n = dict(), 1
%o for i, v in enumerate(A368382_gen(), 1):
%o if v >= n and v not in adict:
%o adict[v] = i
%o while n in adict:
%o yield adict[n]; del adict[n]; n += 1
%o print(list(islice(A368383_gen(), 63))) # _Michael S. Branicky_, Apr 18 2024
%K nonn
%O 1,2
%A _N. J. A. Sloane_, Mar 03 2024