[R] partition functions
Robin Hankin
r.hankin at noc.soton.ac.uk
Mon Feb 6 11:44:20 CET 2006
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
More information about the R-help
mailing list