A348615
Number of non-alternating permutations of {1...n}.
Original entry on oeis.org
0, 0, 0, 2, 14, 88, 598, 4496, 37550, 347008, 3527758, 39209216, 473596070, 6182284288, 86779569238, 1303866853376, 20884006863710, 355267697410048, 6397563946377118, 121586922638606336, 2432161265800164950, 51081039175603191808, 1123862030028821404198
Offset: 0
The a(4) = 14 permutations:
(1,2,3,4) (3,1,2,4)
(1,2,4,3) (3,2,1,4)
(1,3,4,2) (3,4,2,1)
(1,4,3,2) (4,1,2,3)
(2,1,3,4) (4,2,1,3)
(2,3,4,1) (4,3,1,2)
(2,4,3,1) (4,3,2,1)
The complementary version for compositions is
A025047, ranked by
A345167.
The version for ordered factorizations is
A348613, complement
A348610.
A345165 counts partitions w/o an alternating permutation, ranked by
A345171.
A345170 counts partitions w/ an alternating permutation, ranked by
A345172.
A348379 counts factorizations with an alternating permutation.
A348380 counts factorizations without an alternating permutation.
Cf.
A056986,
A102726,
A325534,
A325535,
A344614,
A344653,
A344654,
A347050,
A347706,
A348377,
A348609.
-
b:= proc(u, o) option remember;
`if`(u+o=0, 1, add(b(o-1+j, u-j), j=1..u))
end:
a:= n-> n!-`if`(n<2, 1, 2)*b(n, 0):
seq(a(n), n=0..30); # Alois P. Heinz, Nov 04 2021
-
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]] ==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
Table[Length[Select[Permutations[Range[n]],!wigQ[#]&]],{n,0,6}]
-
from itertools import accumulate, count, islice
def A348615_gen(): # generator of terms
yield from (0,0)
blist, f = (0,2), 1
for n in count(2):
f *= n
yield f - (blist := tuple(accumulate(reversed(blist),initial=0)))[-1]
A348615_list = list(islice(A348615_gen(),40)) # Chai Wah Wu, Jun 09-11 2022
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
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)
- 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.
- Alois P. Heinz, Table of n, a(n) for n = 0..1000 (first 301 terms from T. D. Noe)
- D. Applegate, M. LeBrun and N. J. A. Sloane, Dismal Arithmetic, arXiv:1107.1130 [math.NT], 2001. [Note: we have now changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing]
- Simon Cowell, A Formula for the Reliability of a d-dimensional Consecutive-k-out-of-n:F System, arXiv preprint arXiv:1506.03580 [math.CO], 2015.
- INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 1020
- T. Langley, J. Liese, and J. Remmel, Generating Functions for Wilf Equivalence Under Generalized Factor Order, J. Int. Seq. 14 (2011) # 11.4.2.
- B. E. Merkel, Probabilities of Consecutive Events in Coin Flipping, Master's Thesis, Univ. Cincinatti, May 11 2011.
- D. J. Persico and H. C. Friedman, Another Coin Tossing Problem, Problem 62-6, SIAM Review, 6 (1964), 313-314.
- Eric Weisstein's World of Mathematics, Run.
- Index entries for sequences related to dismal (or lunar) arithmetic
- Index entries for linear recurrences with constant coefficients, signature (3,-1,-2).
The non-contiguous version is
A335455.
-
[2^n-Fibonacci(n+2): n in [0..40]]; // Vincenzo Librandi, Apr 27 2015
-
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
-
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 *)
-
a(n) = 2^n-fibonacci(n+2) \\ Charles R Greathouse IV, Feb 03 2014
-
def A008466(n): return 2^n - fibonacci(n+2) # G. C. Greubel, Apr 23 2025
A056823
Number of compositions minus number of partitions: A011782(n) - A000041(n).
Original entry on oeis.org
0, 0, 0, 1, 3, 9, 21, 49, 106, 226, 470, 968, 1971, 3995, 8057, 16208, 32537, 65239, 130687, 261654, 523661, 1047784, 2096150, 4193049, 8387033, 16775258, 33551996, 67105854, 134214010, 268430891, 536865308, 1073734982, 2147475299, 4294957153, 8589922282
Offset: 0
A011782 begins 1 1 2 4 8 16 32 64 128 256 ...;
A000041 begins 1 1 2 3 5 7 11 15 22 30 ...;
so sequence begins 0 0 0 1 3 9 21 49 106 226 ... .
For n = 3 the factorizations are 8=2*2*2, 12=2*2*3, 18=2*3*3 and 30=2*3*5.
a(5) = 9: {[1,1,1,2], [1,1,2,1], [1,1,3], [1,2,1,1], [1,2,2], [1,3,1], [1,4], [2,1,2], [2,3]}. - _Bob Selcoe_, Jul 08 2014
The version for patterns is
A002051.
(1,2)-avoiding compositions are just partitions
A000041.
The (1,1)-matching version is
A261982.
The version for prime indices is
A335447.
(1,2)-matching compositions are ranked by
A335485.
Patterns matched by compositions are counted by
A335456.
-
a:= n-> ceil(2^(n-1))-combinat[numbpart](n):
seq(a(n), n=0..37); # Alois P. Heinz, Jan 30 2020
-
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!GreaterEqual@@#&]],{n,0,10}] (* Gus Wiseman, Jun 24 2020 *)
a[n_] := If[n == 0, 0, 2^(n-1) - PartitionsP[n]];
a /@ Range[0, 37] (* Jean-François Alcover, May 23 2021 *)
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
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)
The version for standard compositions is
A335458.
The non-contiguous version is
A335456.
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.
-
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}]
A348379
Number of factorizations of n with an alternating permutation.
Original entry on oeis.org
1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 4, 1, 2, 2, 3, 1, 4, 1, 4, 2, 2, 1, 6, 1, 2, 2, 4, 1, 5, 1, 5, 2, 2, 2, 8, 1, 2, 2, 6, 1, 5, 1, 4, 4, 2, 1, 10, 1, 4, 2, 4, 1, 6, 2, 6, 2, 2, 1, 11, 1, 2, 4, 6, 2, 5, 1, 4, 2, 5, 1, 15, 1, 2, 4, 4, 2, 5, 1, 10, 3, 2, 1, 11, 2
Offset: 1
The a(270) = 19 factorizations:
(2*3*3*15) (2*3*45) (2*135) (270)
(2*3*5*9) (2*5*27) (3*90)
(3*3*5*6) (2*9*15) (5*54)
(3*3*30) (6*45)
(3*5*18) (9*30)
(3*6*15) (10*27)
(3*9*10) (15*18)
(5*6*9)
Partitions not of this type are counted by
A345165, ranked by
A345171.
Twins and partitions of this type are counted by
A344740, ranked by
A344742.
A001250 counts alternating permutations.
A339846 counts even-length factorizations.
A339890 counts odd-length factorizations.
Cf.
A038548,
A056986,
A325534,
A335452,
A347437,
A347438,
A347439,
A347442,
A347456,
A347463,
A348381,
A348383,
A348609.
-
facs[n_]:=If[n<=1,{{}},Join@@Table[Map[Prepend[#,d]&,Select[facs[n/d],Min@@#>=d&]],{d,Rest[Divisors[n]]}]];
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
Table[Length[Select[facs[n],Select[Permutations[#],wigQ]!={}&]],{n,100}]
A348610
Number of alternating ordered factorizations of n.
Original entry on oeis.org
1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 6, 1, 3, 3, 4, 1, 6, 1, 6, 3, 3, 1, 12, 1, 3, 3, 6, 1, 11, 1, 7, 3, 3, 3, 15, 1, 3, 3, 12, 1, 11, 1, 6, 6, 3, 1, 23, 1, 6, 3, 6, 1, 12, 3, 12, 3, 3, 1, 28, 1, 3, 6, 12, 3, 11, 1, 6, 3, 11, 1, 33, 1, 3, 6, 6, 3, 11, 1, 23, 4, 3
Offset: 1
The alternating ordered factorizations of n = 1, 6, 12, 16, 24, 30, 32, 36:
() 6 12 16 24 30 32 36
2*3 2*6 2*8 3*8 5*6 4*8 4*9
3*2 3*4 8*2 4*6 6*5 8*4 9*4
4*3 2*4*2 6*4 10*3 16*2 12*3
6*2 8*3 15*2 2*16 18*2
2*3*2 12*2 2*15 2*8*2 2*18
2*12 3*10 4*2*4 3*12
2*4*3 2*5*3 2*6*3
2*6*2 3*2*5 2*9*2
3*2*4 3*5*2 3*2*6
3*4*2 5*2*3 3*4*3
4*2*3 3*6*2
6*2*3
2*3*2*3
3*2*3*2
The complement is counted by
A348613.
A339846 counts even-length factorizations.
A339890 counts odd-length factorizations.
A345165 counts partitions w/o an alternating permutation, ranked by
A345171.
A345170 counts partitions w/ an alternating permutation, ranked by
A345172.
A347463 counts ordered factorizations with integer alternating product.
A348379 counts factorizations w/ an alternating permutation.
A348380 counts factorizations w/o an alternating permutation.
-
ordfacs[n_]:=If[n<=1,{{}},Join@@Table[Prepend[#,d]&/@ordfacs[n/d],{d,Rest[Divisors[n]]}]];
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]] == Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
Table[Length[Select[ordfacs[n],wigQ]],{n,100}]
A348613
Number of non-alternating ordered factorizations of n.
Original entry on oeis.org
0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 2, 0, 0, 0, 4, 0, 2, 0, 2, 0, 0, 0, 8, 1, 0, 1, 2, 0, 2, 0, 9, 0, 0, 0, 11, 0, 0, 0, 8, 0, 2, 0, 2, 2, 0, 0, 25, 1, 2, 0, 2, 0, 8, 0, 8, 0, 0, 0, 16, 0, 0, 2, 20, 0, 2, 0, 2, 0, 2, 0, 43, 0, 0, 2, 2, 0, 2, 0, 25, 4, 0, 0, 16, 0
Offset: 1
The a(n) ordered factorizations for n = 4, 12, 16, 24, 32, 36:
2*2 2*2*3 4*4 2*2*6 2*2*8 6*6
3*2*2 2*2*4 2*3*4 2*4*4 2*2*9
4*2*2 4*3*2 4*4*2 2*3*6
2*2*2*2 6*2*2 8*2*2 3*3*4
2*2*2*3 2*2*2*4 4*3*3
2*2*3*2 2*2*4*2 6*3*2
2*3*2*2 2*4*2*2 9*2*2
3*2*2*2 4*2*2*2 2*2*3*3
2*2*2*2*2 2*3*3*2
3*2*2*3
3*3*2*2
The complement is counted by
A348610.
A001250 counts alternating permutations.
A339846 counts even-length factorizations.
A339890 counts odd-length factorizations.
A345165 counts partitions without an alternating permutation, ranked by
A345171.
A345170 counts partitions with an alternating permutation, ranked by
A345172.
A348379 counts factorizations w/ an alternating permutation, with twins
A347050.
A348380 counts factorizations w/o an alternating permutation, w/o twins
A347706.
A348611 counts anti-run ordered factorizations.
Cf.
A038548,
A056986,
A344614,
A344653,
A344654,
A344740,
A347437,
A347438,
A347463,
A348381,
A348609.
-
ordfacs[n_]:=If[n<=1,{{}},Join@@Table[Prepend[#,d]&/@ordfacs[n/d],{d,Rest[Divisors[n]]}]];
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
Table[Length[Select[ordfacs[n],!wigQ[#]&]],{n,100}]
A214015
Number of permutations A(n,k) in S_n with longest increasing subsequence of length <= k; square array A(n,k), n>=0, k>=0, read by antidiagonals.
Original entry on oeis.org
1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 2, 1, 0, 1, 1, 2, 5, 1, 0, 1, 1, 2, 6, 14, 1, 0, 1, 1, 2, 6, 23, 42, 1, 0, 1, 1, 2, 6, 24, 103, 132, 1, 0, 1, 1, 2, 6, 24, 119, 513, 429, 1, 0, 1, 1, 2, 6, 24, 120, 694, 2761, 1430, 1, 0, 1, 1, 2, 6, 24, 120, 719, 4582, 15767, 4862, 1, 0
Offset: 0
A(4,2) = 14 because 14 permutations of {1,2,3,4} do not contain an increasing subsequence of length > 2: 1432, 2143, 2413, 2431, 3142, 3214, 3241, 3412, 3421, 4132, 4213, 4231, 4312, 4321. Permutation 1423 is not counted because it contains the noncontiguous increasing subsequence 123.
A(4,2) = 14 = 2^2 + 3^2 + 1^2 because the partitions of 4 with <= 2 parts are [2,2], [3,1], [4] with 2, 3, 1 standard Young tableaux, respectively:
+------+ +------+ +---------+ +---------+ +---------+ +------------+
| 1 3 | | 1 2 | | 1 3 4 | | 1 2 4 | | 1 2 3 | | 1 2 3 4 |
| 2 4 | | 3 4 | | 2 .-----+ | 3 .-----+ | 4 .-----+ +------------+
+------+ +------+ +---+ +---+ +---+
Square array A(n,k) begins:
1, 1, 1, 1, 1, 1, 1, 1, ...
0, 1, 1, 1, 1, 1, 1, 1, ...
0, 1, 2, 2, 2, 2, 2, 2, ...
0, 1, 5, 6, 6, 6, 6, 6, ...
0, 1, 14, 23, 24, 24, 24, 24, ...
0, 1, 42, 103, 119, 120, 120, 120, ...
0, 1, 132, 513, 694, 719, 720, 720, ...
0, 1, 429, 2761, 4582, 5003, 5039, 5040, ...
Columns k=0-10 give:
A000007,
A000012,
A000108,
A005802,
A047889,
A047890,
A052399,
A072131,
A072132,
A072133,
A072167.
A(2n,n-1) gives
A269042(n) for n>0.
-
h:= proc(l) local n; n:=nops(l); add(i, i=l)! /mul(mul(1+l[i]-j
+add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= (n, i, l)-> `if`(n=0 or i=1, h([l[], 1$n])^2, `if`(i<1, 0,
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i))):
A:= (n, k)-> `if`(k>=n, n!, g(n, k, [])):
seq(seq(A(n, d-n), n=0..d), d=0..14);
-
h[l_] := With[{n = Length[l]}, Sum[i, {i, l}]! / Product[Product[1+l[[i]]-j + Sum[If[l[[k]] >= j, 1, 0], {k, i+1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
g[n_, i_, l_] := If[n == 0 || i == 1, h[Join[l, Array[1&, n]]]^2, If[i < 1, 0, Sum[g[n - i*j, i-1, Join[l, Array[i&, j]]], {j, 0, n/i}]]];
A[n_, k_] := If[k >= n, n!, g[n, k, {}]];
Table [Table [A[n, d-n], {n, 0, d}], {d, 0, 14}] // Flatten (* Jean-François Alcover, Dec 09 2013, translated from Maple *)
A335460
Number of (1,2,1) or (2,1,2)-matching permutations of the prime indices of n.
Original entry on oeis.org
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 1, 1, 0, 0, 3, 0, 1, 0, 1, 0, 2, 0, 2, 0, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 1, 1, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0
Offset: 1
The a(n) compositions for n = 12, 24, 48, 36, 60, 72:
(121) (1121) (11121) (1212) (1213) (11212)
(1211) (11211) (1221) (1231) (11221)
(12111) (2112) (1312) (12112)
(2121) (1321) (12121)
(2131) (12211)
(3121) (21112)
(21121)
(21211)
The (1,2,1)-matching part is
A335446.
The (2,1,2)-matching part is
A335453.
Replacing "or" with "and" gives
A335462.
Permutations of prime indices are counted by
A008480.
Unsorted prime signature is
A124010. Sorted prime signature is
A118914.
STC-numbers of permutations of prime indices are
A333221.
(1,2,1) and (2,1,2)-avoiding permutations of prime indices are
A333175.
Patterns matched by standard compositions are counted by
A335454.
(1,2,1) and (2,1,2)-matching permutations of prime indices are
A335462.
Dimensions of downsets of standard compositions are
A335465.
-
primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
Table[Length[Select[Permutations[primeMS[n]],MatchQ[#,{_,x_,_,y_,_,x_,_}/;x!=y]&]],{n,100}]
A335515
Number of patterns of length n matching the pattern (1,2,3).
Original entry on oeis.org
0, 0, 0, 1, 19, 257, 3167, 38909, 498235, 6811453, 100623211, 1612937661, 28033056683, 526501880989, 10639153638795, 230269650097469, 5315570416909995, 130370239796988957, 3385531348514480651, 92801566389186549245, 2677687663571344712043, 81124824154544921317597
Offset: 0
The a(3) = 1 through a(4) = 19 patterns:
(1,2,3) (1,1,2,3)
(1,2,1,3)
(1,2,2,3)
(1,2,3,1)
(1,2,3,2)
(1,2,3,3)
(1,2,3,4)
(1,2,4,3)
(1,3,2,3)
(1,3,2,4)
(1,3,4,2)
(1,4,2,3)
(2,1,2,3)
(2,1,3,4)
(2,3,1,4)
(2,3,4,1)
(3,1,2,3)
(3,1,2,4)
(4,1,2,3)
The complement
A226316 is the avoiding version.
Compositions matching this pattern are counted by
A335514 and ranked by
A335479.
Permutations of prime indices matching this pattern are counted by
A335520.
Patterns matching the pattern (1,1) are counted by
A019472.
Permutations matching (1,2,3) are counted by
A056986.
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.
-
allnorm[n_]:=If[n<=0,{{}},Function[s,Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
Table[Length[Select[Join@@Permutations/@allnorm[n],MatchQ[#,{_,x_,_,y_,_,z_,_}/;x
-
seq(n)=Vec( serlaplace(1/(2-exp(x + O(x*x^n)))) - 1/2 - 1/(1+sqrt(1-8*x+8*x^2 + O(x*x^n))), -(n+1)) \\ Andrew Howroyd, Jan 28 2024
Comments