p(n, k) (as per MathWorld) gives the number of partitions of n with no numbers
greater than k, but according to the original post, you want the number of
partitions with no numbers less than k, so it probably isn't the same.
Aaron Meurer
On Dec 6, 2009, at 9:09 PM, smichr wrote:
> You could u
You could use the recurrence relationship (http://
mathworld.wolfram.com/PartitionFunctionP.html)
def p(n,k):
if k>n:
return 0
if k==n:
return 1
if k==0:
return 0
else:
return p(n-1,k-1)+p(n-k,k)
>>> p(5,3)
2
2 of the partitions of 5 will be made
Sometimes we don't think of things until we voice our thoughts to
others :) I guess I really don't need to know p(k, n), but rather
only if p(k_1, n_1) > p(k_2, n_2). Does anybody know if there is a
way of determining the inequality of the number of partitions of two
integers without using the pa
smichr,
Thank you for your response. The algorithm you posted is actually very
similar to the one I am currently using to generate partitions. I also
derived mine from the webpage you linked to. I found the "recipe"
while reading this post http://1100.livejournal.com/4862.html
about a python im
Also, I'm assuming we need to go through all of the Milestone-Release0.6.6
issues [1], and either fix them or postpone them. For example, I think we
should see if we can fix the --random test failures (I narrowed one down in
issue 1747), though some like 1244 will be best to just wait for the n
Vinzent Steinberg wrote:
> If you want to help, you can have a look at the remaining patches to
> be reviewed [1] or improve existing patches [2], thanks!
Thanks for managing this release, Vinzent. I'll get time to help out
when I finish my exams (next week!).
Fabian
>
> Vinzent
>
> [1] http:/
If you want to help, you can have a look at the remaining patches to
be reviewed [1] or improve existing patches [2], thanks!
Vinzent
[1] http://code.google.com/p/sympy/issues/list?q=NeedsReview
[2] http://code.google.com/p/sympy/issues/list?q=NeedsBetterPatch
--
You received this message becau
John, does this do what you are looking for? See the docstring for an
example.
###
def partitions(n, k=1):
"""Generate all partitions of integer n (>= 0) using integers no
greater than k.
Each partition is represented as a multiset, i.e. a dictionary
mapping an integer to the number o