0

Classic subset-sum: Given an integer $T$ and a set of integers $S = \{x_1, x_2, \cdots, x_k\}$ is there a subset of $S$ that such that the sum of the elements of the subset is exactly $T$?

This problem is known to be NP-hard.

Is the following variant known or studied in literature?

Modular subset-sum: Given an integer $T$ and a set of integers $S = \{x_1, x_2, \cdots, x_k\}$ and a modulus $m \in \mathbb{Z}$ is there a subset of $S$ that such that the sum of the elements of the subset is exactly $T \pmod m$?

Does this variant have a polynomial time algorithm for solving it? References appreciated.

Edit: As @GregMartin points out in the comments, if $m$ is greater than the sum of absolute values of $x_j \in S$, then the problem reduces to classic subset-sum. Therefore, we can just consider $m_1 \cdot m_2 \cdot m_3 \cdots m_n > T > m_1 \cdot m_2 \cdot m_3 \cdots m_{n-1}$ where integer $m_j < T$ is the modulus in question. We can even assume that $m_j \sim O(\log T)$.

vvg
  • 3,311
  • Certainly not in general: if $m$ is larger than the sum of the (absolute values of the) $x_j$, then the modular subset-sum problem reduces to the classic subset-sum problem. – Greg Martin May 02 '23 at 09:23

0 Answers0