Given a list such as
{12,9,3,42,30,10,11,1,2}
I would like to place only the multiples of 3 in the natural order without changing the order of the other integers, so I would like to get as a result
{42,30,12,10,11,9,3,1,2}
What is a (simple) way to do this?
Thank you! This is my first post and I tried to read related questions before posting. I am just learning my way around in Mathematica. I am trying to write a little program. Here I will try to clarify the ordering I want to achieve:the integers to the right of 3n are smaller than 3n and those to the left of 3n are larger than 3n. Do not change the ordering of integers that are not multiple of 3. Thank you again. I am reading all your answers and testing them so I understand how they work.
f
,f1
andf2
do give the desired order :) $\endgroup$