4

In general, the subset sum problem is NP-Complete. However, what if we say that our set is $\{1,...,n\}$? Is there a formula/combinatorial calculation that says how many subsets of $\{1,...,n\}$ have their sum equal to $k$?

Raphael
  • 73,212
  • 30
  • 182
  • 400
TheNotMe
  • 571
  • 1
  • 6
  • 18

1 Answers1

1

This is A053632. The prefixes of this sequence convergence to the more well-known A000009, the number of partitions into distinct (or odd) parts. You shouldn't expect a clean formula, though it's of course easy to calculate small terms using dynamic programming.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514