|
|
A368431
|
|
Distinct values of A367562, in order of appearance and with offset 0.
|
|
3
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 10, 8, 9, 11, 12, 13, 14, 15, 20, 21, 18, 22, 16, 17, 19, 23, 24, 25, 26, 27, 28, 29, 30, 31, 42, 40, 41, 43, 44, 36, 37, 45, 34, 38, 46, 32, 33, 35, 39, 47, 50, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 84, 85, 82, 86
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
This sequence is a permutation of the nonnegative integers (with inverse A368432).
|
|
LINKS
|
|
|
EXAMPLE
|
The first terms of A367562 and of the present sequence are:
-- ---------- -- ----
1 0 0 0
2 1 1 1
3 2 2 2
4 0
5 1
6 3 3 3
7 4 4 4
8 5 5 5
9 2
10 6 6 6
11 0
12 1
13 3
14 7 7 7
15 10 8 10
|
|
MATHEMATICA
|
With[{imax=7}, DeleteDuplicates[Map[FromDigits[#, 2]&, Flatten[NestList[Map[Delete[{If[Length[#]>1, Map[#<>"0"&, Rest[#]], Nothing], Join[{#[[1]]<>"0"}, Map[#<>"1"&, #]]}, 0]&], {{"0", "1"}}, imax-1]]]]] (* Generates terms up to order 7 *) (* Paolo Xausa, Dec 28 2023 *)
|
|
PROG
|
(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 agen(): # generator of terms
R, aset = [["0", "1"]], set()
while R:
r = R.pop(0)
for b in r:
d = int(b, 2)
if d not in aset: yield d; aset.add(d)
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))]))
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|