login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A335464 Number of compositions of n with a run of length > 2. 12
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,6
COMMENTS
A composition of n is a finite sequence of positive integers summing to n.
Also compositions contiguously matching the pattern (1,1,1).
LINKS
FORMULA
a(n) = A011782(n) - A128695(n). - Alois P. Heinz, Jul 06 2020
EXAMPLE
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)
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 *)
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.
Sequence in context: A196534 A317188 A360784 * A369733 A026635 A135094
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jul 06 2020
EXTENSIONS
a(23)-a(35) from Alois P. Heinz, Jul 06 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 16:34 EDT 2024. Contains 371254 sequences. (Running on oeis4.)