Re: sieving out selected multiples

*To*: mathgroup at smc.vnet.net*Subject*: [mg113808] Re: sieving out selected multiples*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sun, 14 Nov 2010 06:07:31 -0500 (EST)

eliminateDuplicates[data_List, x_] := Module[{int = Flatten[{x}]}, Fold[If[Count[#1, #2] > 1, ReplacePart[#1, Thread[Rest[Flatten[ Position[#1, #2]]] -> Sequence[]]], #1] &, data, int]] data = RandomInteger[{0, 9}, {50}] eliminateDuplicates[data, 2] eliminateDuplicates[data, {2, 3, 7}] Bob Hanlon ---- Andrea <andrea at radargift.com> wrote: ============= What is the simplest way to delete -- i.e., remove -- the multiples an integer from a list? And what is the simplest way to delete, simultaneously, the multiples from more than one selected integer from a list? I couldn't find a simple Mathematica function for this. Thanks, Andrea