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.

A368427 A permutation related to the Christmas tree pattern map (A367508): a(1) = 1, and for any n > 1, a(n) = A053644(n) + A367562(n-1).

This page as a plain text file.
%I A368427 #20 Dec 28 2023 15:03:56
%S A368427 1,2,3,6,4,5,7,12,13,10,14,8,9,11,15,26,24,25,27,28,20,21,29,18,22,30,
%T A368427 16,17,19,23,31,52,53,50,54,48,49,51,55,56,57,42,58,40,41,43,59,44,60,
%U A368427 36,37,45,61,34,38,46,62,32,33,35,39,47,63,106,104,105
%N A368427 A permutation related to the Christmas tree pattern map (A367508): a(1) = 1, and for any n > 1, a(n) = A053644(n) + A367562(n-1).
%C A368427 This sequence is a permutation of the positive integers (with inverse A368428):
%C A368427 - the Christmas tree pattern map runs through all finite nonempty binary words,
%C A368427 - by prefixing these words with a 1, we obtain the binary expansions of all integers >= 2,
%C A368427 - hence, with the leading term a(1) = 1, we have a permutation of the positive integers.
%C A368427 Apparently, A088163 \ {0} corresponds to the fixed points.
%C A368427 We can also obtain this sequence by applying the Christmas tree pattern map starting from the chain "1" (instead of "0 1") and converting the resulting binary words to decimal.
%H A368427 Rémy Sigrist, <a href="/A368427/b368427.txt">Table of n, a(n) for n = 1..8191</a>
%H A368427 Rémy Sigrist, <a href="/A368427/a368427.gp.txt">PARI program</a>
%H A368427 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A368427 The first terms, alongside their binary expansion and the corresponding word in the Christmas tree pattern map, are:
%e A368427   n   a(n)  bin(a(n))  Xmas word
%e A368427   --  ----  ---------  ---------
%e A368427    1     1          1        N/A
%e A368427    2     2         10          0
%e A368427    3     3         11          1
%e A368427    4     6        110         10
%e A368427    5     4        100         00
%e A368427    6     5        101         01
%e A368427    7     7        111         11
%e A368427    8    12       1100        100
%e A368427    9    13       1101        101
%e A368427   10    10       1010        010
%e A368427   11    14       1110        110
%e A368427   12     8       1000        000
%e A368427   13     9       1001        001
%e A368427   14    11       1011        011
%e A368427   15    15       1111        111
%t A368427 With[{imax=7},Map[FromDigits[#,2]&,Flatten[NestList[Map[Delete[{If[Length[#]>1,Map[#<>"0"&,Rest[#]],Nothing],Join[{#[[1]]<>"0"},Map[#<>"1"&,#]]},0]&],{{"1"}},imax-1]]]] (* Generates terms up to order 7 *) (* _Paolo Xausa_, Dec 28 2023 *)
%o A368427 (PARI) See Links section.
%o A368427 (Python)
%o A368427 from itertools import islice
%o A368427 from functools import reduce
%o A368427 def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, [])
%o A368427 def agen():  # generator of terms
%o A368427     R = [["1"]]
%o A368427     while R:
%o A368427         r = R.pop(0)
%o A368427         yield from map(lambda b: int(b, 2), r)
%o A368427         if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))]))
%o A368427         R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))]))
%o A368427 print(list(islice(agen(), 66))) # _Michael S. Branicky_, Dec 24 2023
%Y A368427 Cf. A053644, A088163, A367508, A367562, A368428 (inverse).
%K A368427 nonn,look,base
%O A368427 1,2
%A A368427 _Rémy Sigrist_, Dec 24 2023