This site is supported by donations to The OEIS Foundation.



"Email this user" was broken Aug 14 to 9am Aug 16. If you sent someone a message in this period, please send it again.

(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A006245 Number of primitive sorting networks on n elements; also number of rhombic tilings of 2n-gon.
(Formerly M1894)
1, 1, 2, 8, 62, 908, 24698, 1232944, 112018190, 18410581880, 5449192389984, 2894710651370536, 2752596959306389652, 4675651520558571537540, 14163808995580022218786390 (list; graph; refs; listen; history; text; internal format)



Also the number of commutation classes of reduced words for the longest element of a Weyl group of type A_{n-1} (see Armstrong reference).

Also the number of oriented matroids of rank 3 on n elements (see Folkman-Lawrence reference). - Matthew J. Samuel, Jan 19 2013


D. Armstrong, The sorting order on a Coxeter group, Journal of Combinatorial Theory 116 (2009), no. 8, 1285-1305.

H Denoncourt, DC Ernst, D Story, On the number of commutation classes of the longest element in the symmetric group, arXiv:1602.08328, 2016.

J. Folkman and J. Lawrence, "Oriented matroids". Journal of Combinatorial Theory, Series B 25 (1978), no. 2, 199-236.

J. Kawahara, T. Saitoh, R. Yoshinaka and S. Minato: "Counting Primitive Sorting Networks by PiDDs," Hokkaido University, Division of Computer Science, TCS Technical Reports, TCS-TR-A-11-54, Oct. 2011.

D. E. Knuth, Axioms and hulls, Lect. Notes Comp. Sci., Vol. 606.

S. Minato, Techniques of BDD/ZDD: Brief History and Recent Activity, IEICE TRANSactions on Information and Systems, Vol. E96-D, No. 7, pp.1419-1429; http://eprints2008.lib.hokudai.ac.jp/dspace/bitstream/2115/53121/1/201309111118.pdf

Shin-ichi Minato, Counting by ZDD, Encyclopedia of Algorithms, 2014, pp. 1-6.

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

K. Yamanaka, S. Nakano, Y. Matsui, R. Uehara and K. Nakada, Efficient enumeration of all ladder lotteries and its application, Theoretical Computer Science, Vol. 411, pp. 1714-1722, 2010.


Table of n, a(n) for n=1..15.

MJ Hay, J Schiff, NJ Fisch, Available free energy under local phase space diffusion, arXiv preprint arXiv:1604.08573, 2016, see Footnote 27.

J. Kawahara, T. Saitoh, R. Yoshinaka and S. Minato, Counting Primitive Sorting Networks by PiDDs

D. E. Knuth, Axioms and Hulls, LNCS 606 (1992) p35. [From R. J. Mathar, Apr 02 2009]

Matthew J. Samuel, Word posets, complexity, and Coxeter groups, arXiv:1101.4655 [math.CO]

M. J. Samuel, Word posets, with applications to Coxeter groups, arXiv preprint arXiv:1108.3638, 2011

M. Widom, N. Destainville, R. Mosseri and F. Bailly, Two-dimensional random tilings of large codimension

Index entries for sequences related to sorting


# classes: Wrapper for computing number of commutation classes;

#   pass a permutation as a list

# Returns number of commutation classes of reduced words

# Longest element is of the form [n, n-1, ..., 1] (see Comments)

classes:=proc(perm) option remember:

    RETURN(classesRecurse(Array(perm), 0, 1)):


#classesRecurse: Recursive procedure for computing number of commutation classes

classesRecurse:=proc(perm, spot, negs) local swaps, i, sums, c, doneany:



    for i from spot to ArrayNumElems(perm)-2 do

        if perm[i+1]>perm[i+2] then




            c:=classes(convert(perm, `list`)):

            sums:=sums+negs*c+classesRecurse(perm, i+2, -negs):







    if spot=0 and doneany=0 then RETURN(1):

    else RETURN(sums):


end:  ## Matthew J. Samuel, Jan 23 2011, Jan 26 2011


classes[perm_List] := classes[perm] = classesRecurse[perm, 0, 1];

classesRecurse[perm_List, spot_, negs_] := Module[{swaps, i, Sums, c, doneany, prm = perm}, Sums = 0; doneany = 0; For[i = spot, i <= Length[prm]-2, i++, If[prm[[i+1]] > prm[[i+2]], swaps = prm[[i+1]]; prm[[i+1]] = prm[[i+2]]; prm[[i+2]] = swaps; c = classes[prm]; Sums = Sums + negs*c + classesRecurse[prm, i+2, -negs]; swaps = prm[[i+1]]; prm[[i+1]] = prm[[i+2]]; prm[[i+2]] = swaps; doneany = 1]]; If[spot == 0 && doneany == 0, Return[1], Return[Sums]]];

a[n_] := a[n] = classes[Range[n] // Reverse];

Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 1, 9}] (* Jean-Fran├žois Alcover, May 09 2017, translated from Maple *)


Cf. A006246.

Sequence in context: A192516 A159476 A230824 * A202751 A227160 A191604

Adjacent sequences:  A006242 A006243 A006244 * A006246 A006247 A006248




N. J. A. Sloane.


More terms from Sebastien VEIGNEAU (sv(AT)univ-mlv.fr) Jan 15 1997.

a(10) confirmed by Katsuhisa Yamanaka(yamanaka(AT)hol.is.uec.ac.jp), May 06 2009. This value was also confirmed by Takashi Horiyama of Saitama Univ.

a(11) from Katsuhisa Yamanaka(yamanaka(AT)hol.is.uec.ac.jp), May 06 2009.

Reference with formula that the Maple program implements added and a(11) verified by Matthew J. Samuel, Jan 25 2011

Removed invalid comment concerning the denominators of the indicated polynomials; added a(12). - Matthew J. Samuel, Jan 30 2011

a(13) from Toshiki Saitoh, Oct 17 2011.

a(14) and a(15) from Yuma Tanaka, Aug 20 2013



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

License Agreements, Terms of Use, Privacy Policy .

Last modified August 20 17:26 EDT 2017. Contains 290837 sequences.