# Finding integers that do not appear on list [closed]

Let's say I imported a large list of numbers into Mathematica, and found the min value and max value. In that range [min,max], how do I find all integers that do not appear in this list?

data = Flatten[Import["file.txt", "Table"]];
M = Max[data]
m = Min[data]


Using

newdata = DeleteDuplicates [data];
Sort[newdata]


I get this:

The range of values are

{19,20,22,..., 126, 128}

So I can tell that 21, for example, is missing

• I'm totally missing your logic here. How exactly can a list have elements larger than its maximum? – J. M.'s technical difficulties Apr 11 '18 at 5:13
• I apologize, I specifically put the range, I'm trying to figure out how to put an output that specifically takes values that are missing in the range – mastud89 Apr 11 '18 at 5:38
• To clarify: you want to get the members of Range[Max[data]] that are not present in data? Have you seen Complement[]? – J. M.'s technical difficulties Apr 11 '18 at 5:46
• I've heard of it, but I forgot what it was used for. I search on it in Wolfram and it's a pretty basic tool to find what is missing in a range of values. – mastud89 Apr 11 '18 at 5:56

Complement[Range[m, M], data]