Given k positive integer numbers a1 < a2 < a3 < … < ak, and all integers greater than ak, we want to check whether the set A = {ai : i ∈ [1,k]} ∪ {n : n > ak, n ∈ ℕ } = {a1, a2, a3, … , ak, ak+1, ak+2, …} is closed under addition. This means that:
∑1 ≤ i ≤ k ai*bi ∈ A, for any non-negative integers bi.
For example, {2,4,6,7,8,….} is closed under addition.
Is there any easy way to do this? Any functions that we could use in Mathematica or Matlab?
If the discontinuous portion less than k of the sets are not large I believe you can approach it directly like this: