Let m=[1,2,3,4,5,6,7,8,9,10]; be a set and let s=[ 2,4,5,6,8,9]; be a subset of m. How do list all missing numbers in s from m.

For example, the missing numbers in s from 1-->10 are 1,3,7,10. So, how can list them?



closed as off-topic by Jason B., RunnyKine, user9660, LLlAMnYP, Yves Klett Mar 17 '16 at 12:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Jason B., RunnyKine, Community, LLlAMnYP, Yves Klett
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ You want Complement $\endgroup$ – Quantum_Oli Mar 17 '16 at 10:44
  • 1
    $\begingroup$ I felt like a downvote at first, but Complement doesn't seem to come up quickly when searching the documentation with keywords from the OP. Still, the documentation deserves a more thoughtful read, Complement is quite a trivial function that comes up early on, learning the language. $\endgroup$ – LLlAMnYP Mar 17 '16 at 11:35

First of all, have a look at,


Constructing Lists

List Manipulation

How to | Use Brackets and Braces Correctly

The Four Kinds of Bracketing in the Wolfram Language



Find which elements in the first list are not in any of the subsequent lists

m = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

s = {2, 4, 5, 6, 8, 9}

Complement[m, s]
{1, 3, 7, 10}

Not the answer you're looking for? Browse other questions tagged or ask your own question.