[R] partition functions

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Mon 06 Feb 2006 - 21:44:20 EST


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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Feb 06 21:55:33 2006

This archive was generated by hypermail 2.1.8 : Tue 07 Feb 2006 - 00:54:32 EST