I would like to determine which elements in a list are divisible by a specific number, lets say 3.
I generate a list with numbers:
numbers = Range[10];
I then use Divisible to create another list of equal length that has True and False entries related to whether or not the entry in numbers are divisible by 3:
In[1] := test = Divisible[numbers, 3]
Out[1] := {False, False, True, False, False, True, False, False, True, False}
The resulting list test thus acts as an index.
How would I go about adding all the items in numbers to a new list if their corresponding item in test is True?
Pickis tailor-made for your task); the closure just establishes a permanent link between this question and other(s), perhaps more general, that people interested in the topic of your question are likely to find useful. – MarcoB Mar 02 '17 at 02:29