#OK to post homework #Victoria Chayes, 2/28/21, Assignment 11 Help:=proc(): print(`RandPnk(n,k), and RandPn(n), EstStatAnalOfLargestPart(n,K,N)`): end: with(combinat): #1 Using the same type as recursion as in Pnk(n,k) and Pn(n), and using the Wilf methodolgy (using pnk(n,k), write procedures RandPnk(n,k), and RandPn(n) that, respectively, genearte, unoformly at random, a partion of n with largest part k, and a partion of n. RandPnk:=proc(n,k) local k1,L,L1: if not (type(n,integer) and type(k,integer) and n>=1 and k>=1 )then RETURN([]): fi: if k>n then RETURN([]): fi: if k=n then RETURN([n]): fi: k1:=LD([seq(pnk(n-k,i),i=1..min(n-k,k))]): [k,op(RandPnk(n-k,k1))]: end: RandPn:=proc(n) local k: k:=LD([seq(pnk(n,i),i=1..n)]): RandPnk(n,k): end: ########################### ### Programs From Class ### ########################### pnk:=proc(n,k) local k1: option remember: if not (type(n,integer) and type(k,integer) and n>=1 and k>=1 )then RETURN(0): fi: if n=k then RETURN(1): else RETURN(add(pnk(n-k,k1),k1=1..min(k,n-k))): fi: end: