1
$\begingroup$

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?

Thanks.

$\endgroup$
2
  • 3
    $\begingroup$ You want Complement $\endgroup$ Mar 17, 2016 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, 2016 at 11:35

1 Answer 1

3
$\begingroup$

First of all, have a look at,

Lists

Constructing Lists

List Manipulation

How to | Use Brackets and Braces Correctly

The Four Kinds of Bracketing in the Wolfram Language

and

Complement

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}
*}
$\endgroup$

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