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.

Showing 1-10 of 35 results. Next

A335456 Number of normal patterns matched by compositions of n.

Original entry on oeis.org

1, 2, 5, 12, 32, 84, 211, 556, 1446, 3750, 9824, 25837, 67681, 178160, 468941, 1233837, 3248788, 8554709
Offset: 0

Views

Author

Gus Wiseman, Jun 16 2020

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n.
We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,1).

Examples

			The 8 compositions of 4 together with the a(4) = 32 patterns they match:
  4:   31:   13:   22:   211:   121:   112:   1111:
-----------------------------------------------------
  ()   ()    ()    ()    ()     ()     ()     ()
  (1)  (1)   (1)   (1)   (1)    (1)    (1)    (1)
       (21)  (12)  (11)  (11)   (11)   (11)   (11)
                         (21)   (12)   (12)   (111)
                         (211)  (21)   (112)  (1111)
                                (121)
		

Crossrefs

References found in the link are not all included here.
The version for standard compositions is A335454.
The contiguous case is A335457.
The version for Heinz numbers of partitions is A335549.
Patterns are counted by A000670 and ranked by A333217.
The n-th composition has A124771(n) distinct consecutive subsequences.
Knapsack compositions are counted by A325676 and ranked by A333223.
The n-th composition has A333257(n) distinct subsequence-sums.
The n-th composition has A334299(n) distinct subsequences.
Minimal patterns avoided by a standard composition are counted by A335465.

Programs

  • Mathematica
    mstype[q_]:=q/.Table[Union[q][[i]]->i,{i,Length[Union[q]]}];
    Table[Sum[Length[Union[mstype/@Subsets[y]]],{y,Join@@Permutations/@IntegerPartitions[n]}],{n,0,8}]

Extensions

a(14)-a(16) from Jinyuan Wang, Jun 26 2020
a(17) from John Tyler Rascoe, Mar 14 2025

A335454 Number of normal patterns matched by the n-th composition in standard order (A066099).

Original entry on oeis.org

1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 5, 3, 6, 5, 5, 2, 3, 3, 5, 3, 5, 6, 7, 3, 6, 5, 9, 5, 9, 7, 6, 2, 3, 3, 5, 3, 4, 5, 7, 3, 5, 4, 7, 5, 10, 9, 9, 3, 6, 5, 9, 4, 9, 10, 12, 5, 9, 7, 13, 7, 12, 9, 7, 2, 3, 3, 5, 3, 4, 5, 7, 3, 5, 5, 7, 6, 10, 9, 9, 3, 5, 6, 8, 5
Offset: 0

Views

Author

Gus Wiseman, Jun 14 2020

Keywords

Comments

We define a (normal) pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,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 a(n) patterns for n = 0, 1, 3, 7, 11, 13, 23, 83, 27, 45:
  0:  1:   11:   111:   211:   121:   2111:   2311:   1211:   2121:
---------------------------------------------------------------------
  ()  ()   ()    ()     ()     ()     ()      ()      ()      ()
      (1)  (1)   (1)    (1)    (1)    (1)     (1)     (1)     (1)
           (11)  (11)   (11)   (11)   (11)    (11)    (11)    (11)
                 (111)  (21)   (12)   (21)    (12)    (12)    (12)
                        (211)  (21)   (111)   (21)    (21)    (21)
                               (121)  (211)   (211)   (111)   (121)
                                      (2111)  (231)   (121)   (211)
                                              (2311)  (211)   (212)
                                                      (1211)  (221)
                                                              (2121)
		

Crossrefs

References found in the links are not all included here.
Summing over indices with binary length n gives A335456(n).
The contiguous case is A335458.
The version for Heinz numbers of partitions is A335549.
Patterns are counted by A000670 and ranked by A333217.
The n-th composition has A124771(n) distinct consecutive subsequences.
Knapsack compositions are counted by A325676 and ranked by A333223.
The n-th composition has A333257(n) distinct subsequence-sums.
The n-th composition has A334299(n) distinct subsequences.
Minimal avoided patterns are counted by A335465.

Programs

  • Mathematica
    stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
    mstype[q_]:=q/.Table[Union[q][[i]]->i,{i,Length[Union[q]]}];
    Table[Length[Union[mstype/@Subsets[stc[n]]]],{n,0,30}]
  • Python
    from itertools import combinations
    def comp(n):
        # see A357625
        return
    def A335465(n):
        A,B,C = set(),set(),comp(n)
        c = range(len(C))
        for j in c:
            for k in combinations(c, j):
                A.add(tuple(C[i] for i in k))
        for i in A:
            D = {v: rank + 1 for rank, v in enumerate(sorted(set(i)))}
            B.add(tuple(D[v] for v in i))
        return len(B)+1 # John Tyler Rascoe, Mar 12 2025

A008466 a(n) = 2^n - Fibonacci(n+2).

Original entry on oeis.org

0, 0, 1, 3, 8, 19, 43, 94, 201, 423, 880, 1815, 3719, 7582, 15397, 31171, 62952, 126891, 255379, 513342, 1030865, 2068495, 4147936, 8313583, 16655823, 33358014, 66791053, 133703499, 267603416, 535524643, 1071563515, 2143959070, 4289264409, 8580707127
Offset: 0

Views

Author

Keywords

Comments

Toss a fair coin n times; a(n) is number of possible outcomes having a run of 2 or more heads.
Also the number of binary words of length n with at least two neighboring 1 digits. For example, a(4)=8 because 8 binary words of length 4 have two or more neighboring 1 digits: 0011, 0110, 0111, 1011, 1100, 1101, 1110, 1111 (cf. A143291). - Alois P. Heinz, Jul 18 2008
Equivalently, number of solutions (x_1, ..., x_n) to the equation x_1*x_2 + x_2*x_3 + x_3*x_4 + ... + x_{n-1}*x_n = 1 in base-2 lunar arithmetic. - N. J. A. Sloane, Apr 23 2011
Row sums of triangle A153281 = (1, 3, 8, 19, 43, ...). - Gary W. Adamson, Dec 23 2008
a(n-1) is the number of compositions of n with at least one part >= 3. - Joerg Arndt, Aug 06 2012
One less than the cardinality of the set of possible numbers of (leaf-) nodes of AVL trees with height n (cf. A143897, A217298). a(3) = 4-1, the set of possible numbers of (leaf-) nodes of AVL trees with height 3 is {5,6,7,8}. - Alois P. Heinz, Mar 20 2013
a(n) is the number of binary words of length n such that some prefix contains three more 1's than 0's or two more 0's than 1's. a(4) = 8 because we have: {0,0,0,0}, {0,0,0,1}, {0,0,1,0}, {0,0,1,1}, {0,1,0,0}, {1,0,0,0}, {1,1,1,0}, {1,1,1,1}. - Geoffrey Critzer, Dec 30 2013
With offset 0: antidiagonal sums of P(j,n) array of j-th partial sums of Fibonacci numbers. - Luciano Ancora, Apr 26 2015

Examples

			From _Gus Wiseman_, Jun 25 2020: (Start)
The a(2) = 1 through a(5) = 19 compositions of n + 1 with at least one part >= 3 are:
  (3)  (4)    (5)      (6)
       (1,3)  (1,4)    (1,5)
       (3,1)  (2,3)    (2,4)
              (3,2)    (3,3)
              (4,1)    (4,2)
              (1,1,3)  (5,1)
              (1,3,1)  (1,1,4)
              (3,1,1)  (1,2,3)
                       (1,3,2)
                       (1,4,1)
                       (2,1,3)
                       (2,3,1)
                       (3,1,2)
                       (3,2,1)
                       (4,1,1)
                       (1,1,1,3)
                       (1,1,3,1)
                       (1,3,1,1)
                       (3,1,1,1)
(End)
		

References

  • W. Feller, An Introduction to Probability Theory and Its Applications, Vol. 1, 2nd ed. New York: Wiley, p. 300, 1968.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 14, Exercise 1.

Crossrefs

Cf. A153281, A186244 (ternary words), A335457, A335458, A335516.
The non-contiguous version is A335455.
Row 2 of A340156. Column 3 of A109435.

Programs

  • Magma
    [2^n-Fibonacci(n+2): n in [0..40]]; // Vincenzo Librandi, Apr 27 2015
    
  • Maple
    a:= n-> (<<3|1|0>, <-1|0|1>, <-2|0|0>>^n)[1, 3]:
    seq(a(n), n=0..50); # Alois P. Heinz, Jul 18 2008
    # second Maple program:
    with(combinat): F:=fibonacci; f:=n->add(2^(n-1-i)*F(i),i=0..n-1); [seq(f(n),n=0..50)]; # N. J. A. Sloane, Mar 31 2014
  • Mathematica
    Table[2^n-Fibonacci[n+2],{n,0,20}] (* Vladimir Joseph Stephan Orlovsky, Jul 22 2008 *)
    MMM = 30;
    For[ M=2, M <= MMM, M++,
    vlist = Array[x, M];
    cl[i_] := And[ x[i], x[i+1] ];
    cl2 = False; For [ i=1, i <= M-1, i++, cl2 = Or[cl2, cl[i]] ];
    R[M] = SatisfiabilityCount[ cl2, vlist ] ]
    Table[ R[M], {M,2,MMM}]
    (* Find Boolean values of variables that satisfy the formula x1 x2 + x2 x3 + ... + xn-1 xn = 1; N. J. A. Sloane, Apr 23 2011 *)
    LinearRecurrence[{3,-1,-2},{0,0,1},40] (* Harvey P. Dale, Aug 09 2013 *)
    nn=33; a=1/(1-2x); b=1/(1-2x^2-x^4-x^6/(1-x^2));
    CoefficientList[Series[b(a x^3/(1-x^2)+x^2a),{x,0,nn}],x] (* Geoffrey Critzer, Dec 30 2013 *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n+1],Max@@#>2&]],{n,0,10}] (* Gus Wiseman, Jun 25 2020 *)
  • PARI
    a(n) = 2^n-fibonacci(n+2) \\ Charles R Greathouse IV, Feb 03 2014
    
  • SageMath
    def A008466(n): return 2^n - fibonacci(n+2) # G. C. Greubel, Apr 23 2025

Formula

a(1)=0, a(2)=1, a(3)=3, a(n) = 3*a(n-1) - a(n-2) - 2*a(n-3). - Miklos Kristof, Nov 24 2003
G.f.: x^2/((1-2*x)*(1-x-x^2)). - Paul Barry, Feb 16 2004
From Paul Barry, May 19 2004: (Start)
Convolution of Fibonacci(n) and (2^n - 0^n)/2.
a(n) = Sum_{k=0..n} (2^k-0^k)*Fibonacci(n-k)/2.
a(n+1) = Sum_{k=0..n} Fibonacci(k)*2^(n-k).
a(n) = 2^n*Sum_{k=0..n} Fibonacci(k)/2^k. (End)
a(n) = a(n-1) + a(n-2) + 2^(n-2). - Jon Stadler (jstadler(AT)capital.edu), Aug 21 2006
a(n) = 2*a(n-1) + Fibonacci(n-1). - Thomas M. Green, Aug 21 2007
a(n) = term (1,3) in the 3 X 3 matrix [3,1,0; -1,0,1; -2,0,0]^n. - Alois P. Heinz, Jul 18 2008
a(n) = 2*a(n-1) - a(n-3) + 2^(n-3). - Carmine Suriano, Mar 08 2011

A335457 Number of normal patterns contiguously matched by compositions of n.

Original entry on oeis.org

1, 2, 5, 12, 31, 80, 196, 486, 1171, 2787, 6564, 15323, 35403, 81251, 185087, 418918, 942525, 2109143, 4695648, 10405694, 22959156
Offset: 0

Views

Author

Gus Wiseman, Jun 23 2020

Keywords

Comments

We define a (normal) pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,1).

Examples

			The a(0) = 1 through a(3) = 12 pairs of a composition with a contiguously matched pattern:
  ()()  (1)()   (2)()     (3)()
        (1)(1)  (11)()    (12)()
                (2)(1)    (21)()
                (11)(1)   (3)(1)
                (11)(11)  (111)()
                          (12)(1)
                          (21)(1)
                          (111)(1)
                          (12)(12)
                          (21)(21)
                          (111)(11)
                          (111)(111)
		

Crossrefs

The version for standard compositions is A335458.
The non-contiguous version is A335456.
Patterns are counted by A000670 and ranked by A333217.
The n-th standard composition has A124771(n) contiguous subsequences.
Patterns contiguously matched by prime indices are A335549.
Minimal avoided patterns of prime indices are counted by A335550.

Programs

  • Mathematica
    mstype[q_]:=q/.Table[Union[q][[i]]->i,{i,Length[Union[q]]}];
    Table[Sum[Length[Union[mstype/@ReplaceList[cmp,{_,s___,_}:>{s}]]],{cmp,Join@@Permutations/@IntegerPartitions[n]}],{n,0,10}]

Extensions

a(16)-a(20) from Jinyuan Wang, Jul 08 2020

A335516 Number of normal patterns contiguously matched by the prime indices of n in increasing or decreasing order, counting multiplicity.

Original entry on oeis.org

1, 2, 2, 3, 2, 3, 2, 4, 3, 3, 2, 5, 2, 3, 3, 5, 2, 5, 2, 5, 3, 3, 2, 7, 3, 3, 4, 5, 2, 4, 2, 6, 3, 3, 3, 7, 2, 3, 3, 7, 2, 4, 2, 5, 5, 3, 2, 9, 3, 5, 3, 5, 2, 7, 3, 7, 3, 3, 2, 7, 2, 3, 5, 7, 3, 4, 2, 5, 3, 4, 2, 10, 2, 3, 5, 5, 3, 4, 2, 9, 5, 3, 2, 7, 3, 3, 3
Offset: 1

Views

Author

Gus Wiseman, Jun 26 2020

Keywords

Comments

First differs from A181796 at a(180) = 9, A181796(180) = 10.
First differs from A335549 at a(90) = 7, A335549(90) = 8.
A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.
We define a (normal) pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to contiguously match a pattern P if there is a contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) contiguously matches (1,1,2) and (2,1,1) but not (2,1,2), (1,2,1), (1,2,2), or (2,2,1).

Examples

			The a(n) patterns for n = 2, 30, 12, 60, 120, 540, 1500:
  ()   ()     ()     ()      ()       ()        ()
  (1)  (1)    (1)    (1)     (1)      (1)       (1)
       (12)   (11)   (11)    (11)     (11)      (11)
       (123)  (12)   (12)    (12)     (12)      (12)
              (112)  (112)   (111)    (111)     (111)
                     (123)   (112)    (112)     (112)
                     (1123)  (123)    (122)     (122)
                             (1112)   (1112)    (123)
                             (1123)   (1122)    (1123)
                             (11123)  (1222)    (1222)
                                      (11222)   (1233)
                                      (12223)   (11233)
                                      (112223)  (12333)
                                                (112333)
		

Crossrefs

The version for standard compositions is A335458.
The not necessarily contiguous version is A335549.
Patterns are counted by A000670 and ranked by A333217.
A number's prime indices are given in the rows of A112798.
Contiguous subsequences of standard compositions are A124771.
Contiguous sub-partitions of prime indices are counted by A335519.
Minimal avoided patterns of prime indices are counted by A335550.
Patterns contiguously matched by partitions are counted by A335838.

Programs

  • Mathematica
    primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    mstype[q_]:=q/.Table[Union[q][[i]]->i,{i,Length[Union[q]]}];
    Table[Length[Union[mstype/@ReplaceList[primeMS[n],{_,s___,_}:>{s}]]],{n,100}]

A335479 Numbers k such that the k-th composition in standard order (A066099) matches the pattern (1,2,3).

Original entry on oeis.org

52, 104, 105, 108, 116, 180, 200, 208, 209, 210, 211, 212, 216, 217, 220, 232, 233, 236, 244, 308, 328, 360, 361, 364, 372, 400, 401, 404, 408, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 428, 432, 433, 434, 435, 436, 440, 441, 444, 456, 464, 465, 466
Offset: 1

Views

Author

Gus Wiseman, Jun 18 2020

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.
We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,1).

Examples

			The sequence of terms together with the corresponding compositions begins:
   52: (1,2,3)
  104: (1,2,4)
  105: (1,2,3,1)
  108: (1,2,1,3)
  116: (1,1,2,3)
  180: (2,1,2,3)
  200: (1,3,4)
  208: (1,2,5)
  209: (1,2,4,1)
  210: (1,2,3,2)
  211: (1,2,3,1,1)
  212: (1,2,2,3)
  216: (1,2,1,4)
  217: (1,2,1,3,1)
  220: (1,2,1,1,3)
		

Crossrefs

The version counting permutations is A056986.
Patterns matching this pattern are counted by A335515 (by length).
Permutations of prime indices matching this pattern are counted by A335520.
These compositions are counted by A335514 (by sum).
Constant patterns are counted by A000005 and ranked by A272919.
Permutations are counted by A000142 and ranked by A333218.
Patterns are counted by A000670 and ranked by A333217.
Non-unimodal compositions are counted by A115981 and ranked by A335373.
Combinatory separations are counted by A269134.
Patterns matched by standard compositions are counted by A335454.
Minimal patterns avoided by a standard composition are counted by A335465.
Other permutations:
- A335479 (1,2,3)
- A335480 (1,3,2)
- A335481 (2,1,3)
- A335482 (2,3,1)
- A335483 (3,1,2)
- A335484 (3,2,1)

Programs

  • Mathematica
    stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
    Select[Range[0,100],MatchQ[stc[#],{_,x_,_,y_,_,z_,_}/;x
    				

A335480 Numbers k such that the k-th composition in standard order (A066099) matches the pattern (1,3,2).

Original entry on oeis.org

50, 98, 101, 102, 114, 178, 194, 196, 197, 198, 202, 203, 205, 206, 210, 226, 229, 230, 242, 306, 324, 354, 357, 358, 370, 386, 388, 389, 390, 393, 394, 395, 396, 397, 398, 402, 404, 405, 406, 407, 410, 411, 413, 414, 418, 421, 422, 434, 450, 452, 453, 454
Offset: 1

Views

Author

Gus Wiseman, Jun 18 2020

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.
We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,1).

Examples

			The sequence of terms together with the corresponding compositions begins:
   50: (1,3,2)
   98: (1,4,2)
  101: (1,3,2,1)
  102: (1,3,1,2)
  114: (1,1,3,2)
  178: (2,1,3,2)
  194: (1,5,2)
  196: (1,4,3)
  197: (1,4,2,1)
  198: (1,4,1,2)
  202: (1,3,2,2)
  203: (1,3,2,1,1)
  205: (1,3,1,2,1)
  206: (1,3,1,1,2)
  210: (1,2,3,2)
		

Crossrefs

The version counting permutations is A056986.
Patterns matching this pattern are counted by A335515 (by length).
Permutations of prime indices matching this pattern are counted by A335520.
These compositions are counted by A335514 (by sum).
Constant patterns are counted by A000005 and ranked by A272919.
Permutations are counted by A000142 and ranked by A333218.
Patterns are counted by A000670 and ranked by A333217.
Non-unimodal compositions are counted by A115981 and ranked by A335373.
Permutations matching (1,3,2,4) are counted by A158009.
Combinatory separations are counted by A269134.
Patterns matched by standard compositions are counted by A335454.
Minimal patterns avoided by a standard composition are counted by A335465.
Other permutations:
- A335479 (1,2,3)
- A335480 (1,3,2)
- A335481 (2,1,3)
- A335482 (2,3,1)
- A335483 (3,1,2)
- A335484 (3,2,1)

Programs

  • Mathematica
    stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
    Select[Range[0,100],MatchQ[stc[#],{_,x_,_,y_,_,z_,_}/;x
    				

A335464 Number of compositions of n with a run of length > 2.

Original entry on oeis.org

0, 0, 0, 1, 1, 3, 8, 18, 39, 86, 188, 406, 865, 1836, 3874, 8135, 17003, 35413, 73516, 152171, 314151, 647051, 1329936, 2728341, 5587493, 11424941, 23327502, 47567628, 96879029, 197090007, 400546603, 813258276, 1649761070, 3343936929, 6772740076, 13707639491
Offset: 0

Views

Author

Gus Wiseman, Jul 06 2020

Keywords

Comments

A composition of n is a finite sequence of positive integers summing to n.
Also compositions contiguously matching the pattern (1,1,1).

Examples

			The a(3) = 1 through a(7) = 18 compositions:
  (111)  (1111)  (1112)   (222)     (1114)
                 (2111)   (1113)    (1222)
                 (11111)  (3111)    (2221)
                          (11112)   (4111)
                          (11121)   (11113)
                          (12111)   (11122)
                          (21111)   (11131)
                          (111111)  (13111)
                                    (21112)
                                    (22111)
                                    (31111)
                                    (111112)
                                    (111121)
                                    (111211)
                                    (112111)
                                    (121111)
                                    (211111)
                                    (1111111)
		

Crossrefs

Compositions contiguously avoiding (1,1) are A003242.
Compositions with some part > 2 are A008466.
Compositions by number of adjacent equal parts are A106356.
Compositions where each part is adjacent to an equal part are A114901.
Compositions contiguously avoiding (1,1,1) are A128695.
Compositions with adjacent parts coprime are A167606.
Compositions contiguously matching (1,1) are A261983.
Compositions with all equal parts contiguous are A274174.
Patterns contiguously matched by compositions are A335457.

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=0, 1, add(`if`(abs(t)<>j,
           b(n-j, j), `if`(t=-j, 0, b(n-j, -j))), j=1..n))
        end:
    a:= n-> ceil(2^(n-1))-b(n, 0):
    seq(a(n), n=0..40);  # Alois P. Heinz, Jul 06 2020
  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],MatchQ[#,{_,x_,x_,x_,_}]&]],{n,0,10}]
    (* Second program: *)
    b[n_, t_] := b[n, t] = If[n == 0, 1, Sum[If[Abs[t] != j,
         b[n - j, j], If[t == -j, 0, b[n - j, -j]]], {j, 1, n}]];
    a[n_] := Ceiling[2^(n-1)] - b[n, 0];
    a /@ Range[0, 40] (* Jean-François Alcover, May 21 2021, after Alois P. Heinz *)

Formula

a(n) = A011782(n) - A128695(n). - Alois P. Heinz, Jul 06 2020

Extensions

a(23)-a(35) from Alois P. Heinz, Jul 06 2020

A335482 Numbers k such that the k-th composition in standard order (A066099) matches the pattern (2,3,1).

Original entry on oeis.org

41, 81, 83, 89, 105, 145, 161, 163, 165, 166, 167, 169, 177, 179, 185, 209, 211, 217, 233, 289, 290, 291, 297, 305, 321, 323, 325, 326, 327, 329, 331, 332, 333, 334, 335, 337, 339, 345, 353, 355, 357, 358, 359, 361, 369, 371, 377, 401, 417, 419, 421, 422, 423
Offset: 1

Views

Author

Gus Wiseman, Jun 18 2020

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.
We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,1).

Examples

			The sequence of terms together with the corresponding compositions begins:
   41: (2,3,1)
   81: (2,4,1)
   83: (2,3,1,1)
   89: (2,1,3,1)
  105: (1,2,3,1)
  145: (3,4,1)
  161: (2,5,1)
  163: (2,4,1,1)
  165: (2,3,2,1)
  166: (2,3,1,2)
  167: (2,3,1,1,1)
  169: (2,2,3,1)
  177: (2,1,4,1)
  179: (2,1,3,1,1)
  185: (2,1,1,3,1)
		

Crossrefs

The version counting permutations is A056986.
Patterns matching this pattern are counted by A335515 (by length).
Permutations of prime indices matching this pattern are counted by A335520.
These compositions are counted by A335514 (by sum).
Constant patterns are counted by A000005 and ranked by A272919.
Permutations are counted by A000142 and ranked by A333218.
Patterns are counted by A000670 and ranked by A333217.
Non-unimodal compositions are counted by A115981 and ranked by A335373.
Permutations matching (1,3,2,4) are counted by A158009.
Combinatory separations are counted by A269134.
Patterns matched by standard compositions are counted by A335454.
Minimal patterns avoided by a standard composition are counted by A335465.
Other permutations:
- A335479 (1,2,3)
- A335480 (1,3,2)
- A335481 (2,1,3)
- A335482 (2,3,1)
- A335483 (3,1,2)
- A335484 (3,2,1)

Programs

  • Mathematica
    stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
    Select[Range[0,100],MatchQ[stc[#],{_,x_,_,y_,_,z_,_}/;z
    				

A335485 Numbers k such that the k-th composition in standard order (A066099) is not weakly decreasing.

Original entry on oeis.org

6, 12, 13, 14, 20, 22, 24, 25, 26, 27, 28, 29, 30, 38, 40, 41, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 70, 72, 76, 77, 78, 80, 81, 82, 83, 84, 86, 88, 89, 90, 91, 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106
Offset: 1

Views

Author

Gus Wiseman, Jun 18 2020

Keywords

Comments

Also compositions matching the pattern (1,2).
A composition of n is a finite sequence of positive integers summing to n. 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 terms together with the corresponding compositions begins:
   6: (1,2)
  12: (1,3)
  13: (1,2,1)
  14: (1,1,2)
  20: (2,3)
  22: (2,1,2)
  24: (1,4)
  25: (1,3,1)
  26: (1,2,2)
  27: (1,2,1,1)
  28: (1,1,3)
  29: (1,1,2,1)
  30: (1,1,1,2)
  38: (3,1,2)
  40: (2,4)
		

Crossrefs

The complement A114994 is the avoiding version.
The (2,1)-matching version is A335486.
Patterns matching this pattern are counted by A002051 (by length).
Permutations of prime indices matching this pattern are counted by A335447.
These compositions are counted by A056823 (by sum).
Constant patterns are counted by A000005 and ranked by A272919.
Permutations are counted by A000142 and ranked by A333218.
Patterns are counted by A000670 and ranked by A333217.
Non-unimodal compositions are counted by A115981 and ranked by A335373.
Combinatory separations are counted by A269134.
Patterns matched by standard compositions are counted by A335454.
Minimal patterns avoided by a standard composition are counted by A335465.

Programs

  • Mathematica
    stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
    Select[Range[0,100],MatchQ[stc[#],{_,x_,_,y_,_}/;x
    				
Showing 1-10 of 35 results. Next