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.

A335471 Number of compositions of n avoiding the pattern (1,2,1).

This page as a plain text file.
%I A335471 #12 Dec 31 2020 15:36:18
%S A335471 1,1,2,4,7,13,23,40,67,115,190,311,505,807,1285,2031,3164,4896,7550,
%T A335471 11499,17480,26379,39558,58946,87469,129051,189484,277143,403477,
%U A335471 584653,844236,1213743,1738372,2481770,3528698,5003364,7070225,9958387,13982822,19580613,27333403
%N A335471 Number of compositions of n avoiding the pattern (1,2,1).
%C A335471 Also the number of (1,1,2)-avoiding or (2,1,1)-avoiding compositions.
%C A335471 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).
%C A335471 A composition of n is a finite sequence of positive integers summing to n.
%H A335471 Andrew Howroyd, <a href="/A335471/b335471.txt">Table of n, a(n) for n = 0..1000</a>
%H A335471 Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation_pattern">Permutation pattern</a>
%H A335471 Gus Wiseman, <a href="https://oeis.org/A102726/a102726.txt">Sequences counting and ranking compositions by the patterns they match or avoid.</a>
%F A335471 a(n > 0) = 2^(n - 1) - A335470(n).
%F A335471 a(n) = F(n,n,1) where F(n,m,k) = F(n,m-1,k) + k*(Sum_{i=1..floor(n/m)} F(n-i*m, m-1, k+i)) for m > 0 with F(0,m,k)=1 and F(n,0,k)=0 otherwise. - _Andrew Howroyd_, Dec 31 2020
%e A335471 The a(0) = 1 through a(5) = 13 compositions:
%e A335471   ()  (1)  (2)   (3)    (4)     (5)
%e A335471            (11)  (12)   (13)    (14)
%e A335471                  (21)   (22)    (23)
%e A335471                  (111)  (31)    (32)
%e A335471                         (112)   (41)
%e A335471                         (211)   (113)
%e A335471                         (1111)  (122)
%e A335471                                 (212)
%e A335471                                 (221)
%e A335471                                 (311)
%e A335471                                 (1112)
%e A335471                                 (2111)
%e A335471                                 (11111)
%t A335471 Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!MatchQ[#,{___,x_,___,y_,___,x_,___}/;x<y]&]],{n,0,10}]
%o A335471 (PARI) a(n)={local(Cache=Map()); my(F(n,m,k)=if(m>n, m=n); if(m==0, n==0, my(hk=[n,m,k], z); if(!mapisdefined(Cache,hk,&z), z=self()(n,m-1,k) + k*sum(i=1,n\m, self()(n-i*m, m-1, k+i)); mapput(Cache, hk, z)); z)); F(n,n,1)} \\ _Andrew Howroyd_, Dec 31 2020
%Y A335471 The version for patterns is A001710.
%Y A335471 The version for prime indices is A335449.
%Y A335471 These compositions are ranked by A335467.
%Y A335471 The complement A335470 is the matching version.
%Y A335471 The (2,1,2)-avoiding version is A335473.
%Y A335471 Constant patterns are counted by A000005 and ranked by A272919.
%Y A335471 Permutations are counted by A000142 and ranked by A333218.
%Y A335471 Patterns are counted by A000670 and ranked by A333217.
%Y A335471 Compositions are counted by A011782.
%Y A335471 Compositions avoiding (1,2,3) are counted by A102726.
%Y A335471 Non-unimodal compositions are counted by A115981 and ranked by A335373.
%Y A335471 Combinatory separations are counted by A269134.
%Y A335471 Patterns matched by compositions are counted by A335456.
%Y A335471 Minimal patterns avoided by a standard composition are counted by A335465.
%Y A335471 Cf. A034691, A056986, A106356, A232464, A238279, A333213, A333755.
%K A335471 nonn
%O A335471 0,3
%A A335471 _Gus Wiseman_, Jun 17 2020
%E A335471 Terms a(21) and beyond from _Andrew Howroyd_, Dec 31 2020