###################################################################### ##PERCY.txt: Save this file as PERCY.txt # ## To use it, stay in the # ##same directory, get into Maple (by typing: maple ) # ##and then type: read PERCY.txt # ##Then follow the instructions given there # ## # ##Written by Doron Zeilberger, Rutgers University , # #zeilberg at math dot rutgers dot edu # ###################################################################### #Created: June 13, 2016 print(`Created: June 13, 2016`): print(` This is PERCY.txt `): print(`It is the Maple package that generated the article `): print(` On the Most Commonly-Occuring Score Vectors of American Tournaments of n-players, and their Corresponding Records `): print(`by Shalosh B. Ekhad`): print(`and also available from Zeilberger's website`): print(``): print(`Please report bugs to zeilberg at math dot rutgers dot edu`): print(``): print(`The most current version of this package and paper`): print(` are available from`): print(`http://www.math.rutgers.edu/~zeilberg/ .`): print(`---------------------------------------`): print(`For a list of the Supporting procedures type ezra1();, for help with`): print(`a specific procedure, type ezra(procedure_name); .`): print(``): print(`---------------------------------------`): print(`---------------------------------------`): print(`For a list of the MAIN procedures type ezra();, for help with`): print(`a specific procedure, type ezra(procedure_name); .`): print(``): print(`---------------------------------------`): with(combinat): ezra1:=proc() if args=NULL then print(` The supporting procedures are: C, Pars, Pars1, PtoM, Vecs`): print(``): else ezra(args): fi: end: ezra:=proc() if args=NULL then print(`The main procedures are: MC, Percy `): print(` `): elif nops([args])=1 and op(1,[args])=C then print(`C(L): inputs a score vector and outputs the number of tournaments with that score-vector. Try`): print(` C([2,1,0]); `): elif nops([args])=1 and op(1,[args])=MC then print(`MC(n): inputs a positive integer n, and outputs the most popular score-vector together with the number of tournaments realizing it.`): print(`Try: MC(4);`): elif nops([args])=1 and op(1,[args])=Mul then print(`Mul(L): the multiplicity of the partition L. Try:`): print(`Mul([3,3,2,2,2]);`): elif nops([args])=1 and op(1,[args])=Pars then print(`Pars(N,n): the set of partitions of N into n-parts including 0. such that L[i]<=n-i and the score-vector condition is fullfiled.Try:`): print(`Pars(6,4);`): elif nops([args])=1 and op(1,[args])=Pars1 then print(`Pars1(N,k,n): the set of partitions of N into n-parts including 0, with largest part k and the score-vector of tournament conditions. Try`): print(`Pars1(6,2,4);`): elif nops([args])=1 and op(1,[args])=Percy then print(`Percy(N): inputs a positive integer N, and generates an article extending P.A. MacMahon's atricle about American tournaments. `): print(`In particular, it gives the first N terms (starting with n=2) of the OEIS sequence A274098. Try:`): print(`Percy(10); `): elif nops([args])=1 and op(1,[args])=PtoM then print(`PtoM(L): Given a partition L converts it to multiplicity notation. Try:`): print(`PtoM([3,3,3,2,2,2,2]); `): elif nops([args])=1 and op(1,[args])=Vecs then print(`Vecs(m,n): all the 0-1 vectors of length n that add-up to m (or with m 1s). Try:`): print(` Vecs(4,2); `): else print(`There is no ezra for`,args): fi: end: with(combinat): #Pars1(N,k,n): the set of partitions of N into n-parts including 0, with largest part k and the score-vector of tournament conditions. Try #Pars1(6,2,4); Pars1:=proc(N,k,n) local gu,k1,mu,mu1: option remember: if n=1 then if N=k then RETURN({[N]}): else RETURN({}): fi: fi: if k>N then RETURN({}): fi: gu:={}: for k1 from 0 to k do mu:=Pars1(N-k,k1,n-1): for mu1 in mu do if convert(mu1,`+`)>=binomial(n,2)-k then gu:=gu union {[k,op(mu1)]}: fi: od: od: gu: end: #Pars(N,n): the set of partitions of N into n-parts including 0. such that L[i]<=n-i and the score-vector condition is fullfiled.Try: #Pars(6,4); Pars:=proc(N,n) local k1: option remember: if n=0 then if N=0 then RETURN({[]}): else RETURN({}): fi: fi: {seq(op(Pars1(N,k1,n)),k1=0..n)}: end: #Vecs(m,n): all the 0-1 vectors of length n that add-up to m (or with m 1s). Try: #Vecs(4,2); Vecs:=proc(m,n) local mu0,mu1,mu0a,mu1a: option remember: if n=0 then if m=0 then RETURN({[]}): else RETURN({}): fi: fi: if m<0 or m>n then RETURN({}): fi: mu0:=Vecs(m,n-1): mu1:=Vecs(m-1,n-1): {seq([0,op(mu0a)],mu0a in mu0)} union {seq([1,op(mu1a)],mu1a in mu1)} : end: #C(L): inputs a score vector and outputs the number of tournaments with that score-vector. Try #C([2,1,0]); C:=proc(L) local n,i,lu,lu1, L2,gu: option remember: n:=nops(L): if convert(L,`+`)<>binomial(n,2) then RETURN(FAIL): fi: if n=1 then RETURN(1): fi: lu:=Vecs(n-1-L[1],n-1): gu:=0: for lu1 in lu do L2:=sort([seq(L[i]-lu1[i-1],i=2..n)]): gu:=gu+C(L2): od: gu: end: #PtoM(L): Given a partition L converts it to multiplicity notation PtoM:=proc(L) local i,L1: if L=[] then RETURN([]): fi: for i from 1 to nops(L) while L[i]=L[1] do od: i:=i-1: L1:=[op(i+1..nops(L),L)]: [[L[1],i],op(PtoM(L1))]: end: #Mul(L): the multiplicity of the partition L Mul:=proc(L) local gu,i: gu:=PtoM(L): gu:=[seq(gu[i][2],i=1..nops(gu))]: convert(gu,`+`)!/mul(gu[i]!,i=1..nops(gu)): end: #MC(n): inputs a positive integer n, and outputs the most popular score-vector together with the number of tournaments realizing it. #Try: MC(4); MC:=proc(n) local si,gu,gu1,alufim,hal: gu:=Pars(binomial(n,2),n): si:=0: for gu1 in gu do hal:=C(gu1)*Mul(gu1): if hal>si then alufim:={gu1}: si:=hal: elif hal=si then alufim:=alufim union {gu1}: fi: od: si,alufim: end: #Percy(N): inputs a positive integer N, and outputs the first N terms (starting with n=2) of the OEIS sequence A274098 Percy:=proc(N) local n,gu,mu: print(`On the Most Commonly-Occurring Score Vectors of American Tournaments of n-players, and their Corresponding Records`): print(``): print(`By Shalosh B. Ekhad`): print(``): print(`In his beautiful article, "An American Tournament Treated by the Calculus of Symmetric Functions"`): print(` Quarterly J. of Pure and Applied Mathematics. vol. XLIX, No. 193, 1920`): print(`The Combinatorial Giant, (and amazing human calculator), Major Percy Alexander MacMahon`): print(`considered round-robin tournaments for n players for n from 2 to 9, and for each found all the`): print(`possible score vectors, and determined the most popular one, as well as the number of times it shows up`): print(``): print(`In this article, we continue this work up to n=`, N, `and thereby continue OEIS sequence A274098 `): print(`currently (June 13, 2016) only containing the terms MacMahon computed purely by hand`): print(``): mu:=[]: for n from 2 to N do gu:=MC(n): print(``): print(`------------------------------------------`): print(``): print(`In a torunament with`, n, `players `): if nops(gu[2])>1 then print(`The set of champion score vectors is`, gu[2]): else print(`The sole champion score-vector is`, gu[2][1]): fi: print(`the corresponding record is`, gu[1]): mu:=[op(mu),gu[1]]: od: print(``): print(`------------------------------------------`): print(``): print(`In conclusion, the n=2 thorough n=`, N, `of OEIS sequence A274098 are `): print(``): lprint(mu): print(``): print(`------------------------------------------`): print(``): print(`This ends this article, that took`, time(), `seconds to produce. `): end: