Before I reinvent the wheel, has anyone coded up the partition function p()? [ for any integer p, p(n) is the number of distinct ways of writing n as the sum of positive integers, with order not considered. For 5, we have 5 = 4+1 = 3+2 = 2+2+1 = 2+1+1+1 = 1+1+1+1+1 (ie 6 different ways) so p(5) = 6. ] -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743