Use distinct
var multiples = (from i in Enumerable.Range(min, (max - min)) from r in roots where i % r == 0 select i).Distinct();
This works well on simple types like string and int . not very good on anonymous types.
In your case, i is an int , and so it must be aware of dublicates.
EDIT
It works with anonymous types (see Jeppe comment). because, as @Jeppe said, anonymous types have a “good” Equals enabeling Distict to determine if objects are equal / duplicated.
source share