Counting Summations¶
We want $p(100) - 1$, where $p(n)$ is the partition function. We subtract 1 because $p(n)$ counts $n$ by itself as a partition of $n$, but we only want partitions composed of two or more numbers.
Guess what? SageMath has this built-in.
In [1]:
number_of_partitions(100) - 1
Out[1]:
190569291
Alternatively, if we think of this problem like problem 31 - just with coins of every possible denomination instead of only a few - we can adapt any of our approaches to that problem, where we construct a generating function.
In [2]:
R.<x> = PowerSeriesRing(ZZ, default_prec=101)
G = 1 / prod(1 - x^n for n in range(1, 100))
G[100]
Out[2]:
190569291
Relevant sequences¶
- Partition numbers: A000041
Copyright (C) 2025 filifa¶
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license and the BSD Zero Clause license.