#C13.txt: Dr. Z.'s ExpMath (Rutgers), Oct. 20, 2016 Help:=proc(): print(` Pnk(n,k), Pn(n), pn(n), SeqPd(N) , SeqPe(N) , SeqPeD(N) , CheckEuler(N), SeqPnF(N) `): end: #Pnk(n,k): the set of partitions of n with largest part k Pnk:=proc(n,k) local k1,S, S1,s1: option remember: if n<0 then RETURN({}): fi: if n=0 then RETURN({[]}): fi: if k>n or k<1 then RETURN({}): fi: S:={}: for k1 from 1 to k do S1:=Pnk(n-k,k1): S:=S union {seq( [k,op(s1)],s1 in S1)}: od: S: end: #P(n): the set of integer partitions of n Pn:=proc(n) local k: {seq(op(Pnk(n,k)),k=1..n)}: end: #p(n): the number of integer partitions of n pn:=proc(n) local k: add(pnk(n,k),k=1..n): end: #pnk(n,k): the set of partitions of n with largest part k pnk:=proc(n,k) local k1: option remember: if n=k then RETURN(1): fi: if k>n or k<1 then RETURN(0): fi: add(pnk(n-k,k1),k1=1..min(k,n-k)): end: #SeqPd(N): the list of the first N p(n), via procedure pn(n) SeqPd:=proc(N) local n: [seq(pn(n),n=1..N)]: end: #SeqPe(N): the list of the first N p(n), via Euler's famous generating function SeqPe:=proc(N) local f,q,i: f:=taylor(mul(1/(1-q^i),i=1..N),q=0,N+1): [seq(coeff(f,q,i),i=1..N)]: end: #SeqPeD(N): the list of the first N coeficients of the (1-q)(1-q^2)(1-q^3)... #Sum((-1)^j*q^((3*j-1)*j/2,j=-infinity..infinity) SeqPeD:=proc(N) local f,q,i: f:=taylor(mul(1-q^i,i=1..N),q=0,N+1): [seq(coeff(f,q,i),i=1..N)]: end: #CheckEuler(N): checks Euler's Pentagonal theorem up to N CheckEuler:=proc(N) local f,j,g: f:=taylor(mul(1-q^i,i=1..N),q=0,N+1): f:=f-add((-1)^j*q^((3*j-1)*j/2),j=-trunc(sqrt(N))..trunc(sqrt(N))): evalb({seq(coeff(f,q,i),i=1..N)}= {0}): end: #pnF(N): p(n), using the recurrence implied by Euler's Pentagonal #Theorem (famously used by Major Percy MacMahon to compile a table up to N=200, and Ramanujan #used them to conjecture his famous congruences pnF:=proc(n) local f,q,i,j: option remember: if n<0 then 0: elif n=1 then 1: else -add((-1)^j*pnF(n-(3*j-1)*j/2),j=1..trunc(sqrt(3*n/2))+3) -add((-1)^j*pnF(n-(3*j+1)*j/2),j=1..trunc(sqrt(3*n/2))+3): fi: end: #SeqPnF(N): The sequence p(n), using the recurrence implied by Euler's Pentagonal #Theorem (famously used by Major Percy MacMahon to compile a table up to N=200, and Ramanujan #used them to conjecture his famous congruences SeqPnF:=proc(N) local n: [seq(pnF(n),n=2..N+1)]: end: