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.

Previous Showing 21-25 of 25 results.

A334274 Numbers k such that the k-th composition in standard order is both a necklace and a reversed co-necklace.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 8, 10, 12, 14, 15, 16, 20, 24, 26, 28, 30, 31, 32, 36, 40, 42, 48, 52, 54, 56, 58, 60, 62, 63, 64, 72, 80, 84, 96, 100, 104, 106, 108, 112, 116, 118, 120, 122, 124, 126, 127, 128, 136, 144, 160, 164, 168, 170, 192, 200, 204, 208, 212, 216
Offset: 1

Views

Author

Gus Wiseman, Apr 25 2020

Keywords

Comments

Also numbers whose binary expansion is both a reversed necklace and a co-necklace.
A necklace is a finite sequence of positive integers that is lexicographically less than or equal to any cyclic rotation. Co-necklaces are defined similarly, except with greater instead of less.
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.

Examples

			The sequence of all reversed co-necklace necklaces begins:
    0: ()            31: (1,1,1,1,1)      100: (1,3,3)
    1: (1)           32: (6)              104: (1,2,4)
    2: (2)           36: (3,3)            106: (1,2,2,2)
    3: (1,1)         40: (2,4)            108: (1,2,1,3)
    4: (3)           42: (2,2,2)          112: (1,1,5)
    6: (1,2)         48: (1,5)            116: (1,1,2,3)
    7: (1,1,1)       52: (1,2,3)          118: (1,1,2,1,2)
    8: (4)           54: (1,2,1,2)        120: (1,1,1,4)
   10: (2,2)         56: (1,1,4)          122: (1,1,1,2,2)
   12: (1,3)         58: (1,1,2,2)        124: (1,1,1,1,3)
   14: (1,1,2)       60: (1,1,1,3)        126: (1,1,1,1,1,2)
   15: (1,1,1,1)     62: (1,1,1,1,2)      127: (1,1,1,1,1,1,1)
   16: (5)           63: (1,1,1,1,1,1)    128: (8)
   20: (2,3)         64: (7)              136: (4,4)
   24: (1,4)         72: (3,4)            144: (3,5)
   26: (1,2,2)       80: (2,5)            160: (2,6)
   28: (1,1,3)       84: (2,2,3)          164: (2,3,3)
   30: (1,1,1,2)     96: (1,6)            168: (2,2,4)
		

Crossrefs

The aperiodic case is A334267.
Compositions of this type are counted by A334271.
Normal sequences of this type are counted by A334272.
Binary (or reversed binary) necklaces are counted by A000031.
Necklace compositions are counted by A008965.
All of the following pertain to compositions in standard order (A066099):
- Necklaces are A065609.
- Reversed necklaces are A333943.
- Co-necklaces are A333764.
- Reversed co-necklaces are A328595.
- Lyndon words are A275692.
- Co-Lyndon words are A326774.
- Reversed Lyndon words are A334265.
- Reversed co-Lyndon words are A328596.
- Aperiodic compositions are A328594.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    neckQ[q_]:=Length[q]==0||Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    coneckQ[q_]:=Length[q]==0||Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
    Select[Range[0,100],neckQ[stc[#]]&&coneckQ[Reverse[stc[#]]]&]

A334297 Length of the Lyndon factorization of the reversed n-th composition in standard order.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 2, 2, 3, 4, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 5, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 6, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2
Offset: 0

Views

Author

Gus Wiseman, Apr 25 2020

Keywords

Comments

We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).
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.

Examples

			The 12345th composition is (1,7,1,1,3,1), with reverse (1,3,1,1,7,1), with Lyndon factorization ((1),(1,3),(1,1,7)), so a(12345) = 3.
		

Crossrefs

The non-reversed version is A329312.
The version for binary indices is A329313 (also the "co-" version).
Positions of 1's are A334265 (reversed Lyndon words).
Binary Lyndon words are counted by A001037 and ranked by A102659.
Lyndon compositions are counted by A059966 and ranked by A275692.
Normal Lyndon sequences are counted by A060223 (row sums of A296372).
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Necklaces are A065609.
- Sum is A070939.
- Reverse is A228351 (triangle).
- Strict compositions are A233564.
- Constant compositions are A272919.
- Lyndon words are A275692.
- Co-Lyndon words are A326774.
- Reversed co-Lyndon words are A328596.
- Aperiodic compositions are A328594.
- Distinct rotations are counted by A333632.
- Lyndon factorizations are counted by A333940.
- Length of co-Lyndon factorization is A334029.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    lynQ[q_]:=Length[q]==0||Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#]]&]]]];
    Table[Length[lynfac[Reverse[stc[n]]]],{n,0,100}]

A333942 Number of multiset partitions of a multiset whose multiplicities are the parts of the n-th composition in standard order.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 5, 5, 7, 9, 11, 7, 11, 11, 15, 7, 12, 16, 21, 16, 26, 26, 36, 12, 21, 26, 36, 21, 36, 36, 52, 11, 19, 29, 38, 31, 52, 52, 74, 29, 52, 66, 92, 52, 92, 92, 135, 19, 38, 52, 74, 52, 92, 92, 135, 38, 74, 92, 135, 74, 135, 135, 203, 15, 30, 47
Offset: 0

Views

Author

Gus Wiseman, Apr 16 2020

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n. The k-th composition in standard order (row k of 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.

Examples

			The a(1) = 1 through a(11) = 11 multiset partitions:
  {1}  {11}    {12}    {111}      {112}      {122}      {123}
       {1}{1}  {1}{2}  {1}{11}    {1}{12}    {1}{22}    {1}{23}
                       {1}{1}{1}  {2}{11}    {2}{12}    {2}{13}
                                  {1}{1}{2}  {1}{2}{2}  {3}{12}
                                                        {1}{2}{3}
  {1111}        {1112}        {1122}        {1123}
  {1}{111}      {1}{112}      {1}{122}      {1}{123}
  {11}{11}      {11}{12}      {11}{22}      {11}{23}
  {1}{1}{11}    {2}{111}      {12}{12}      {12}{13}
  {1}{1}{1}{1}  {1}{1}{12}    {2}{112}      {2}{113}
                {1}{2}{11}    {1}{1}{22}    {3}{112}
                {1}{1}{1}{2}  {1}{2}{12}    {1}{1}{23}
                              {2}{2}{11}    {1}{2}{13}
                              {1}{1}{2}{2}  {1}{3}{12}
                                            {2}{3}{11}
                                            {1}{1}{2}{3}
		

Crossrefs

The described multiset has A000120 distinct parts.
The sum of the described multiset is A029931.
Multisets of compositions are A034691.
The described multiset is a row of A095684.
Combinatory separations of normal multisets are A269134.
The product of the described multiset is A284001.
The version for prime indices is A318284.
The version counting combinatory separations is A334030.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Sum is A070939.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Length of Lyndon factorization is A329312.
- Dealings are counted by A333939.
- Distinct parts are counted by A334028.
- Length of co-Lyndon factorization is A334029.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    ptnToNorm[y_]:=Join@@Table[ConstantArray[i,y[[i]]],{i,Length[y]}];
    facs[n_]:=If[n<=1,{{}},Join@@Table[Map[Prepend[#,d]&,Select[facs[n/d],Min@@#>=d&]],{d,Rest[Divisors[n]]}]];
    Table[Length[facs[Times@@Prime/@ptnToNorm[stc[n]]]],{n,0,30}]

Formula

a(n) = A001055(A057335(n)).

A339608 Numbers whose bijective base-2 representation is a Lyndon word.

Original entry on oeis.org

1, 2, 4, 8, 10, 16, 18, 22, 32, 34, 36, 38, 42, 46, 64, 66, 68, 70, 74, 76, 78, 86, 94, 128, 130, 132, 134, 136, 138, 140, 142, 146, 148, 150, 154, 156, 158, 170, 174, 182, 190, 256, 258, 260, 262, 264, 266, 268, 270, 274, 276, 278, 280, 282, 284, 286, 292, 294, 298, 300, 302, 308
Offset: 1

Views

Author

Harald Korneliussen, Dec 09 2020

Keywords

Comments

A Lyndon word is a word which is lexicographically smaller than all its nontrivial rotations.
From the Chen-Fox-Lyndon theorem, every word can be written in a unique way as a concatenation of a nonincreasing sequence of Lyndon words. Since each natural number has a unique string representation in bijective bases, it can also be written exactly one way as a concatenation of these numbers in nonincreasing lexicographic order, in bijective base-2.

Examples

			1 and 2 are in this sequence, since their bijective base-2 representations are also just "1" and "2", and words of just one letter have no nontrivial rotations.
3 is not in this sequence, since written in bijective base-2 it becomes "11", which is equal to its single nontrivial rotation.
108 is not in this sequence, since in bijective base-2 it becomes "212212", which is larger than two of its nontrivial rotations (both equal to "122122"). However, "212212" can be uniquely split into the lexicographically nonincreasing sequence of Lyndon words "2", "122" and "12", corresponding to 2, 10 and 4 in this sequence.
		

Crossrefs

Formula

Observation: a(n) = 2*A326774(n-1), n >= 2. (At least for the terms from the Data section). - Omar E. Pol, Dec 09 2020
A007931(a(n)) = A102659(n). - Alois P. Heinz, Dec 09 2020
a(n) = A329327(n) - 1. - Harald Korneliussen, Mar 02 2021

A373399 For any number m, let m* be the bi-infinite string obtained by repetition of the binary expansion of m; a(n) is the least k such that the binary expansion of n appears in k*.

Original entry on oeis.org

1, 2, 1, 4, 2, 5, 1, 8, 4, 2, 5, 9, 5, 11, 1, 16, 8, 4, 9, 18, 2, 5, 11, 17, 9, 21, 5, 19, 11, 23, 1, 32, 16, 8, 17, 4, 18, 9, 19, 34, 18, 2, 21, 37, 5, 11, 23, 33, 17, 37, 9, 38, 21, 5, 11, 35, 19, 43, 11, 39, 23, 47, 1, 64, 32, 16, 33, 8, 34, 17, 35, 68, 4
Offset: 1

Views

Author

Rémy Sigrist, Jun 04 2024

Keywords

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   1     1       1          1
   2     2      10         10
   3     1      11          1
   4     4     100        100
   5     2     101         10
   6     5     110        101
   7     1     111          1
   8     8    1000       1000
   9     4    1001        100
  10     2    1010         10
  11     5    1011        101
  12     9    1100       1001
  13     5    1101        101
  14    11    1110       1011
  15     1    1111          1
  16    16   10000      10000
		

Crossrefs

Programs

  • PARI
    \\ See Links section.
    
  • Python
    def a(n):
        target = bin(n)[2:]
        for m in range(1, n):
            b = bin(m)[2:]
            mstar = b*(2*len(target)//len(b))
            if target in mstar:
                return m
        return n
    print([a(n) for n in range(1, 74)]) # Michael S. Branicky, Jun 14 2024

Formula

a(n) <= n with equality iff n is a power of 2.
a(2^k - 1) = 1 for any k > 0.
Previous Showing 21-25 of 25 results.