What function would map the set of natural numbers to the set of natural numbers excluding multiples of 2 and 3

discrete mathematicselementary-number-theoryelementary-set-theory

This question is concerned only with natural numbers. Assume you have a set $x=[0,1,2,3,4,…,n]$ for an arbitrary limit $n$ or $m$ (such that the cardinality is the same) which maps to $y=[1,2,3,4,…,m]$. Then a function that does the mapping is obviously $y=f(x)=x+1$. If you change $y$ so it only has odd numbers, i.e. $x=[1,3,5,7,…n]$ then the function would be $y=f(x)=2x+1$. What would be function that skips multiples of 2 and 3, i.e. $x=[0,1,2,3,4,…,n]$ and $y=[1,5,7,11,13,17,19,23,25,…,m]$ ?

Best Answer

Note that set $y$ can be written as

$$y=\{6(0)+1,6(1)-1,6(1)+1,6(2)-1,6(2)+1,6(3)-1,6(3)+1,...\}$$

So first we need a function that maps $\{0,1,2,3,4,5,6,...\} \to \{0,1,1,2,2,3,3,...\}$; that could be either

$$\left \lfloor \dfrac{x+1}{2} \right \rfloor \quad \text{or} \quad \left \lceil \dfrac{x}{2} \right \rceil$$

Next we need a function that maps $\{0,1,2,3,4,5,6,...\} \to \{1,-1,1,-1,1,-1,1,...\}$; that would be

$$(-1)^n$$

Thus the required function (at least two versions of it) could be

$$y=6\left \lfloor \dfrac{x+1}{2} \right \rfloor + (-1)^x \qquad \text{or} \qquad 6\left \lceil \dfrac{x}{2} \right \rceil + (-1)^x$$