I have an array a and I would like to repeat the elements of a n times if they are even or if they are positive. I mean I want to repeat only the elements that respect some condition.
If a=[1,2,3,4,5] and n=2 and the condition is even, then I want a to be a=[1,2,2,3,4,4,5].