Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Sumset gives the sumset of a collection of sets or the h-fold sumset of a set
ResourceFunction["Sumset"][A1,A2,…] gives the sorted set of sums a1+a2+⋯ (with repetitions removed) where ai∈Ai. | |
ResourceFunction["Sumset"][h,A] gives the sorted set of sums a1+a2+⋯+ah (with repetitions removed) where ai∈A. |
Compute the 6-fold sumset of a set of integers:
In[1]:= |
Out[1]= |
Compute the sumset of points in the plane:
In[2]:= |
Out[3]= |
Compute the sumset of points in 3-space:
In[4]:= |
Out[6]= |
The expected size of Complement[Range[2,n],Sumset[2,A]] is just under 10, if A is a random subset of Range[1,n] (reference is Many Sets have More Sums than Differences, G. Martin and K. O'Bryant, Additive combinatorics, 287--305, CRM Proc. Lecture Notes, 43, Amer. Math. Soc., Providence, RI, 2007):
In[7]:= |
Out[9]= |
As h grows, Sumset[h,A] grows to contain the interior of a polygon (scaled to h):
In[10]:= |
Out[11]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License