Sorry, the question seems to be extremely simple, but I fail to find an answer. I have an integer sequence
1, 2, 3, ... 8
I would like to convert it to
1, 2, 3, 4, 1, 2, 3, 4
What mathematical operation would give me this result?
An obvious solution is mod: (in Matlab)
a = mod(1:8, 4)
but it of course results in
1, 2, 3, 0, 1, 2, 3, 0.
You want to do
or in Python