login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A368431 Distinct values of A367562, in order of appearance and with offset 0. 3

%I #21 Dec 28 2023 15:04:08

%S 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,

%T 26,27,28,29,30,31,42,40,41,43,44,36,37,45,34,38,46,32,33,35,39,47,50,

%U 48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,84,85,82,86

%N Distinct values of A367562, in order of appearance and with offset 0.

%C This sequence is a permutation of the nonnegative integers (with inverse A368432).

%H Rémy Sigrist, <a href="/A368431/b368431.txt">Table of n, a(n) for n = 0..8191</a>

%H Rémy Sigrist, <a href="/A368431/a368431.gp.txt">PARI program</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%e The first terms of A367562 and of the present sequence are:

%e k A367562(k) n a(n)

%e -- ---------- -- ----

%e 1 0 0 0

%e 2 1 1 1

%e 3 2 2 2

%e 4 0

%e 5 1

%e 6 3 3 3

%e 7 4 4 4

%e 8 5 5 5

%e 9 2

%e 10 6 6 6

%e 11 0

%e 12 1

%e 13 3

%e 14 7 7 7

%e 15 10 8 10

%t 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 *)

%o (PARI) See Links section.

%o (Python)

%o from itertools import islice

%o from functools import reduce

%o def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, [])

%o def agen(): # generator of terms

%o R, aset = [["0", "1"]], set()

%o while R:

%o r = R.pop(0)

%o for b in r:

%o d = int(b, 2)

%o if d not in aset: yield d; aset.add(d)

%o if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))]))

%o R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))]))

%o print(list(islice(agen(), 70))) # _Michael S. Branicky_, Dec 24 2023

%Y Cf. A367508, A367562, A368432 (inverse).

%K nonn,look,base

%O 0,3

%A _Rémy Sigrist_, Dec 24 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 4 11:10 EDT 2024. Contains 373988 sequences. (Running on oeis4.)