boxed partitions
Michael Somos
somos at grail.cba.csuohio.edu
Sun Oct 17 00:02:45 CEST 1999
/* This GP/PARI code is based on Wouter Meeussen's Mathematica code */
/* number of partitions of n with Ferrers plot inside axb box */
T(n,a,b) =
{
if(n<1,n>=0&a>=0&b>=0, /* take care of n nonpositive */
if(b<a,T(n,b,a), /* take advantage of symmetry */
if(a<0,0, /* box must be nonnegative */
if(a*b-n<n,T(a*b-n,a,b), /* use complement in box */
if(a==1,b>=n, /* base case is width 1 box */
sum(i=0,n\a, T(n-a*i,a-1,b-i)) /* otherwise induct on a */
)))))
}
/* number of partitions of n with largest of k parts being m */
U(n,k,m) = T(n,k,m)-T(n,k,m-1)-T(n,k-1,m)+T(n,k-1,m-1)
This may not be the most efficient code possible, but it is interesting to
note the patterns that it generates. For example :
gp> for(a=1,10,for(b=1,10,print1(U(10,a,b)","));print)
0,0,0,0,0,0,0,0,0,1,
0,0,0,0,1,1,1,1,1,0,
0,0,0,2,2,2,1,1,0,0,
0,0,2,3,2,1,1,0,0,0,
0,1,2,2,1,1,0,0,0,0,
0,1,2,1,1,0,0,0,0,0,
0,1,1,1,0,0,0,0,0,0,
0,1,1,0,0,0,0,0,0,0,
0,1,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,
Lots of sequences here if someone took the time to write them up.
Shalom, Michael
--
Michael Somos <somos at grail.cba.csuohio.edu> Cleveland State University
http://grail.cba.csuohio.edu/~somos/ Cleveland, Ohio, USA 44115
More information about the SeqFan
mailing list