cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A368383 a(n) = index of n in A368382, or -1 if n is missing from that sequence.

This page as a plain text file.
%I A368383 #25 Apr 20 2024 03:01:12
%S A368383 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 A368383 17,323,15,57,9,321,175,55,173,15490,171,53,169,317,167,51,165,1167,
%U A368383 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 A368383 a(n) = index of n in A368382, or -1 if n is missing from that sequence.
%H A368383 Chai Wah Wu, <a href="/A368383/b368383.txt">Table of n, a(n) for n = 1..10000</a>
%o A368383 (Python)
%o A368383 from itertools import count
%o A368383 def A368383(n):
%o A368383     a, aset, p = 1, {0,1}, 2
%o A368383     for c in count(1):
%o A368383         if a==n: return c
%o A368383         for b in count(a%p,p):
%o A368383             if b not in aset:
%o A368383                 aset.add(b)
%o A368383                 a, p = b, 3 if p == 2 else p+2
%o A368383                 break # _Chai Wah Wu_, Mar 05 2024
%o A368383 (Python) # faster for initial segment of sequence
%o A368383 def A368383_gen(): # uses A368382_gen/imports from _Chai Wah Wu_ in A368382
%o A368383     adict, n = dict(), 1
%o A368383     for i, v in enumerate(A368382_gen(), 1):
%o A368383         if v >= n and v not in adict:
%o A368383             adict[v] = i
%o A368383             while n in adict:
%o A368383                 yield adict[n]; del adict[n]; n += 1
%o A368383 print(list(islice(A368383_gen(), 63))) # _Michael S. Branicky_, Apr 18 2024
%K A368383 nonn
%O A368383 1,2
%A A368383 _N. J. A. Sloane_, Mar 03 2024