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.

A368432 Inverse permutation to A368431.

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