How to map one-to-one set $A$ into set $B$?

71 Views Asked by At

I have the ordered set $$A=\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}.$$ I need to map the elements of set $A$ into elements of set $$B=\{0, 3, 2, 1, 0, 3, 2, 1, 0, 3\}.$$ I have tried to use the function: $B_i=(A_i+4) \mod 4, i=1,2,...,10$.

My result is: $$B'=\{0, 1, 2, 3, 0, 1, 2, 3, 0, 1\}.$$

Question. How to rewrite the function in order to map set $A$ to set $B$?

1

There are 1 best solutions below

0
On BEST ANSWER

Hint: How can you turn $0,−1,−2,−3,−4,\cdots$ into B?

The observation comes from the idea that $3, 2, 1$ is a recurring descending subsequence. Since the mod operator is allowed, we can let $0$ into this party by modding everything $0,-1,-2,-3,-4,\cdots$ by $4$.