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.

A368428 Inverse permutation to A368427.

This page as a plain text file.
%I A368428 #13 Dec 27 2023 12:33:46
%S A368428 1,2,3,5,6,4,7,12,13,10,14,8,9,11,15,27,28,24,29,21,22,25,30,17,18,16,
%T A368428 19,20,23,26,31,58,59,54,60,50,51,55,61,44,45,42,46,48,52,56,62,36,37,
%U A368428 34,38,32,33,35,39,40,41,43,47,49,53,57,63,121,122,116
%N A368428 Inverse permutation to A368427.
%H A368428 Rémy Sigrist, <a href="/A368428/b368428.txt">Table of n, a(n) for n = 1..8191</a>
%H A368428 Rémy Sigrist, <a href="/A368428/a368428.gp.txt">PARI program</a>
%H A368428 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A368428 A368427(67) = 107, so a(107) = 67.
%o A368428 (PARI) See Links section.
%o A368428 (Python)
%o A368428 from itertools import islice
%o A368428 from functools import reduce
%o A368428 def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, [])
%o A368428 def A368427gen(): # generator of terms of A368427
%o A368428     R = [["1"]]
%o A368428     while R:
%o A368428         r = R.pop(0)
%o A368428         yield from map(lambda b: int(b, 2), r)
%o A368428         if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))]))
%o A368428         R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))]))
%o A368428 def agen(): # generator of terms
%o A368428     adict, n = dict(), 1
%o A368428     for i, k in enumerate(A368427gen(), 1):
%o A368428         if k not in adict:
%o A368428             adict[k] = i
%o A368428         while n in adict: yield adict[n]; n += 1
%o A368428 print(list(islice(agen(), 66))) # _Michael S. Branicky_, Dec 24 2023
%Y A368428 Cf. A368427.
%K A368428 nonn,look,base
%O A368428 1,2
%A A368428 _Rémy Sigrist_, Dec 24 2023