A368428 Inverse permutation to A368427.
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, 19, 20, 23, 26, 31, 58, 59, 54, 60, 50, 51, 55, 61, 44, 45, 42, 46, 48, 52, 56, 62, 36, 37, 34, 38, 32, 33, 35, 39, 40, 41, 43, 47, 49, 53, 57, 63, 121, 122, 116
Offset: 1
Examples
A368427(67) = 107, so a(107) = 67.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..8191
- Rémy Sigrist, PARI program
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
Cf. A368427.
Programs
-
PARI
See Links section.
-
Python
from itertools import islice from functools import reduce def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, []) def A368427gen(): # generator of terms of A368427 R = [["1"]] while R: r = R.pop(0) yield from map(lambda b: int(b, 2), r) if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))])) R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))])) def agen(): # generator of terms adict, n = dict(), 1 for i, k in enumerate(A368427gen(), 1): if k not in adict: adict[k] = i while n in adict: yield adict[n]; n += 1 print(list(islice(agen(), 66))) # Michael S. Branicky, Dec 24 2023