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.

A349051 Numbers k such that the k-th composition in standard order is an alternating permutation of {1..k} for some k.

Original entry on oeis.org

0, 1, 5, 6, 38, 41, 44, 50, 553, 562, 582, 593, 610, 652, 664, 708, 788, 808, 16966, 17036, 17048, 17172, 17192, 17449, 17458, 17542, 17676, 17712, 17940, 18000, 18513, 18530, 18593, 18626, 18968, 18992, 19496, 19536, 20625, 20676, 20769, 20868, 21256, 22600
Offset: 1

Views

Author

Gus Wiseman, Nov 08 2021

Keywords

Comments

The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
A sequence is alternating if it is alternately strictly increasing and strictly decreasing, starting with either. For example, the partition (3,2,2,2,1) has no alternating permutations, even though it does have the anti-run permutations (2,3,2,1,2) and (2,1,2,3,2).

Examples

			The sequence together with the corresponding compositions begins:
        0: ()
        1: (1)
        5: (2,1)
        6: (1,2)
       38: (3,1,2)
       41: (2,3,1)
       44: (2,1,3)
       50: (1,3,2)
      553: (4,2,3,1)
      562: (4,1,3,2)
      582: (3,4,1,2)
      593: (3,2,4,1)
      610: (3,1,4,2)
      652: (2,4,1,3)
      664: (2,3,1,4)
      708: (2,1,4,3)
      788: (1,4,2,3)
      808: (1,3,2,4)
    16966: (5,3,4,1,2)
    17036: (5,2,4,1,3)
		

Crossrefs

These permutations are counted by A001250, complement A348615.
Compositions of this type are counted by A025047, complement A345192.
Subset of A333218, which ranks permutations of initial intervals.
Subset of A345167, which ranks alternating compositions, complement A345168.
A003242 counts Carlitz (anti-run) compositions.
A345163 counts normal partitions with an alternating permutation.
A345164 counts alternating permutations of prime indices.
A345170 counts partitions with an alternating permutation.
Compositions in standard order are the rows of A066099:
- Number of parts is given by A000120, distinct A334028.
- Sum and product of parts are given by A070939 and A124758.
- Maximum and minimum parts are given by A333766 and A333768.
- GCD and LCM are given by A326674 and A333226.
- Maximal runs and anti-runs are counted by A124767 and A333381.
- Heinz number is given by A333219.
- Runs-resistance is given by A333628.
- Partitions and strict partitions are ranked by A114994 and A333256.
- Multisets and sets are ranked by A225620 and A333255.
- Strict and constant compositions are ranked by A233564 and A272919.
- Carlitz (anti-run) compositions are ranked by A333489.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]== Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
    Select[Range[0,1000],Sort[stc[#]]==Range[Length[stc[#]]]&&wigQ[stc[#]]&]

Formula

Equals A333218 (permutation) /\ A345167 (alternating).